« Back to channel list

#RubyOnRails - 05 October 2013

« Back 1 day Forward 1 day »
[00:00:22] dopie: how do i define a nested resource on the root_path ?
[00:02:03] iwaffles: Is anyone else getting an update stream prematurely closed connection error when setting response.headers["My-custom-header"] = 33 on nginx?
[00:12:54] epochwolf: dopie: I don't think you can.
[00:16:12] dopie: cant i do like a Foo.where() "!@?
[00:17:26] bradherman: what do you mean? like you want your root path to hit a nested controller?
[00:19:06] bradherman: you will likely just need to define the routes manually???. match '/', to: 'users#index', via: :get???. match '/:id', to: 'users#show', via: :get
[00:19:17] luckyruby: How do I assign attributes without saving in rails 2.3? #assign_attributes is a private method in 2.3.x
[00:19:57] bradherman: or do attributes =
[00:19:59] luckyruby: I'm looking for mass assignment
[00:20:10] bradherman: model.attributes = {attr1: 1, attr2: 2}
[00:20:27] cored: I'm confuse about something using Rails 4.x I added haml-rails gem to my Gemfile
[00:20:36] cored: how can I change the application.html.erb layout
[00:20:45] cored: to be a haml file ?
[00:20:47] bradherman: just change the name
[00:20:50] bradherman: application.haml
[00:21:02] bradherman: and convert the code, obviously to haml
[00:21:29] cored: bradherman: I thougth that this was going to happen automatically
[00:21:50] bradherman: no, the gem just lets you parse haml in the application
[00:22:13] cored: bradherman: I see
[00:22:14] bradherman: you can use http://html2haml.heroku.com/
[00:22:21] bradherman: to convert existing html
[00:22:23] cored: bradherman: checking
[00:22:26] bradherman: but keep in mind thats bugggy
[00:22:39] cored: bradherman: this is the default application and starting a new app
[00:23:17] bradherman: yeah, doesn't matter??? including haml gem just lets the application understand wth a file with .haml is and how to compile it to html
[00:23:36] bradherman: you still need to write haml and make sure your file names end in .haml
[00:23:57] bradherman: IMO you should just avoid haml
[00:24:12] sarmiena_: has anyone got ckeditor 4.0.6 to work with image uploads? i'm getting errors like "undefined local variable or method `root_path' for" because it's trying to use my app's layout
[00:24:14] bradherman: makes some files cleaner, but a lot of things more ugly and harder to understand
[00:24:41] bradherman: https://github.com/tsechingho/ckeditor-rails
[00:24:46] bradherman: sarmiena_: https://github.com/tsechingho/ckeditor-rails
[00:25:21] cored: bradherman: are you using erb?
[00:25:34] cored: bradherman: got it
[00:25:36] bradherman: i use haml in a few projects, but have moved back away from it
[00:25:42] bradherman: there is a performance overhead in haml
[00:25:51] bradherman: and like i said, some thing are unnecessarily complicated in haml
[00:26:06] gwillen: bradherman: can't you always escape into erb from inside haml?
[00:26:15] gwillen: (I've never used haml but I was thinking of switching because it looks awesome)
[00:26:19] bradherman: but then you're doing even more parsing
[00:26:34] bradherman: if you want cleaner files, look at presenters and just general better view writing
[00:26:53] bradherman: i actually really like haml, but it's just not worth using??? the benefits aren't worth the drawbacks
[00:26:59] sarmiena_: bradherman: we've been using https://github.com/galetahub/ckeditor for rails 3. but since upgrade, getting errors as described above. seems like too blatant of an error to go unnoticed
[00:27:23] bradherman: https://github.com/galetahub/ckeditor/issues/307
[00:27:34] sarmiena_: switching over would be difficult due to models and stuff it generates
[00:27:36] bradherman: always check the open issues
[00:27:49] cored: bradherman: I see, will go with erb then
[00:31:36] bradherman: ok, heading out
[01:05:37] iwaffles: Anyone ever had that error with nginx/passenger/rails? Getting the update stream prematurely closed connection when setting response.headers = ...
[01:25:05] henn1nk: it seems that dalli store (memcached) doesn't work on production server, how can i test this
[01:28:12] delinquentme: so how can I automate the install of something like the passenger configuration script ... since when I run $ passenger-install-nginx-module it asks for prompts !!!!!!!!!!!!!!!!!!! how do automate something like this!?
[01:34:10] Hates_: delinquentme: there's an unattended flag you can pass it
[01:34:38] Hates_: delinquentme: --auto
[01:35:06] delinquentme: Hates_, but then how do you specify what the inputs should be?
[01:35:17] delinquentme: i'd assume some kind of command line flags...
[01:35:30] Hates_: delinquentme: take a look at something like this https://www.linode.com/stackscripts/view/?StackScriptID=163
[01:35:42] pontiki: curious if anyone has tried cloud66 for their deployments?
[01:36:01] Hates_: delinquentme: you can pass anything prompted for as a flag
[01:36:02] Kamil__: hi, anyone can see this message? testing new client..sorry
[01:36:07] Hates_: delinquentme: I'm off to bed now
[01:36:09] pontiki: hi Kamil__
[01:36:11] delinquentme: Hates_, do you see what I see here?!
[01:36:16] Kamil__: pontiki: thank you ;]
[01:36:20] delinquentme: 182 ubunt install scripts ...
[01:36:26] delinquentme: dis is umayze
[01:36:41] Hates_: delinquentme: :)
[01:37:38] Hates_: delinquentme: there are some good ones in there that'll setup everything you could need
[01:38:11] Hates_: delinquentme: just watch out when it includes another stackscript
[01:38:24] delinquentme: Hates_, you're saying keep an eye out for calls like wget
[01:38:53] delinquentme: or one of these things: source <ssinclude StackScriptID=44> # Enable Universe
[01:38:57] Hates_: delinquentme: no like line 10 in that one I linked to, it's including another one
[01:39:01] Hates_: delinquentme: yeah that
[01:40:21] Hates_: delinquentme: good luck :)
[01:48:41] boytoy: Shouldn't this seeds file, because of find_or_create_by_username, not try to overwrite the user if he / she exists? https://gist.github.com/kakekake89/6835619
[01:48:44] boytoy: Ie. http://stackoverflow.com/questions/3476987/appending-to-rake-dbseed-in-rails-and-running-it-without-duplicating-data
[01:48:59] boytoy: * Shouldn't this seed
[01:51:42] crankharder: boytoy: no idea, but I'd think a 'seeds' file would be executed once when the DB is empty... that's the point, right?
[01:52:19] boytoy: crankharder: most of the time yeah
[01:52:26] boytoy: but incase I have some new seeds I wanna add or whatever
[01:53:24] tpayne84: I have a New Form that populates a collection_select with values from the DB??? Relations for instance New User Form will populate the possible companies that a user could belong to??? and possible groups??? Later I have a Record object that I want to filter the Populated Users Select based on the selected company??? I am sure this can be done??? but I have no idea how
[01:54:00] boytoy: im just gonna do if User.count == 0 instead.. less cryptic as well
[02:06:27] Stevenrego: paid to click websites...
[02:07:34] QaDeS: ah. nopa, sorry ;)
[02:08:26] anconia: How is everyonee?
[02:09:56] Stevenrego: http://Fun4Days.Com/?share=161502
[02:10:54] Stevenrego: http://Fun4Days.com/sms/sms.php?share=161502
[02:13:01] rehat: I am so lost, so I have two models that are HABTM to each other and I made a foreign table for them called forms_dealers. But when I try to create a Dealer model and try to destroy it I get an error message that dealers_forms table does not exist
[02:13:18] rehat: do I need to create two foreign key tables?
[02:14:40] rushed: rehat: convention is that the models in a crossover a listed in alpha order & *d*ealers is before *f*orms
[02:15:02] rushed: rehat: so you can drop yours and create the expected, or pass yours in as an option explicitly if you don't want to follow convention
[02:15:38] rehat: rushed: thanks, I did not know that
[02:15:56] rehat: is there a proper way to delete a model or should I just delete the file
[02:17:34] rehat: nvm got it
[02:20:35] orolo: i'm creating an object via ajax and i'd like to return the object params via JSON so i can update my DOM with that form data. i have a standard create method: https://gist.github.com/cernalpanic/046dbf69849a2ff1c639
[02:20:53] orolo: but when i log out 'data' in my ajax call, i get the DOM returned to me as a string.
[02:21:30] orolo: what do i need to return, and how do i access it? thank you
[02:23:28] orolo: console.log rhizome
[02:23:53] rhizome: no clue. is the request asking for json?
[02:24:33] orolo: yes, it is.
[02:24:59] orolo: rhizome: no, it wasn't
[02:25:05] orolo: (i was looking at wrong method)
[02:25:10] orolo: works now. thank you.
[02:38:13] Stevenrego: http://Visitors2Cash.com/ref.php?refId=145617
[02:39:46] boytoy: Stevenrego: cool whats this?
[02:41:25] Stevenrego: paid to click...
[02:41:41] Stevenrego: u click n I get paid... u can do the same... :)
[02:42:46] boytoy: Stevenrego: really?
[02:42:57] boytoy: that's great man
[02:54:16] krz: any tutorials/recommended reading for specifically creating an ORM?
[03:01:17] Matix: I'm doing from a controller: render partial: "foo/bar", myvar: @myobj
[03:01:19] Matix: is it correct?
[03:01:36] Matix: I'm getting in foo/_bar.html.erb that myvar is nil (not undefined but nill)
[03:10:40] anconia: What does everyone do here full-time?
[03:15:10] n88: anconia: look at pictures of cats
[03:30:59] veinofstars: n88: how goes your night
[03:47:16] orolo: i have a modal form that i'm rendering to create objects via ajax. but how do use that same modal form to edit an existing object? i'm not sure how to pass the object id to that form.
[03:49:11] orolo: i know the id of the object i want to update on the javascript side. how do i pass that id to my <%= form_for @thisObject %>
[03:55:04] rhizome: Stevenrego: get out of here with that
[03:55:46] rhizome: orolo: use whatever instance variable you like, just set them up in #new and #edit as normal
[03:56:50] orolo: rhizome. ok. still thinking about this.
[04:05:22] orolo: here's my q distilled: when i click a button on the dom, i use an ajax request to go to my method and return a JSON version of my object. in erb, how do i set that json object as a regular old rails @object?
[04:11:55] jhn: orolo: can't you just serialize it in your controller before returning it back?
[04:13:10] orolo: i can get it back as an object in my ajax success method; i'm trying to figure out how to pass it to an erb form_for.
[04:16:53] sarmiena_: probably a longshot, but does anyone know why rails 4 removed *args from ActiveSupport::Callbacks#run_callbacks? http://pastie.org/8379081
[04:20:02] jhn: orolo: yeah, so you can serialize it in your controller and store it in an instance variable, then it'll be available in the view.
[04:20:33] orolo: jun; ok, i get that part. in ruby, i do how access that var?
[04:20:51] jhn: which var?
[04:21:05] jhn: the instance variable?
[04:21:25] jhn: @your_varialbe
[04:22:04] jhn: instance variables are accessible from your views.
[04:22:18] orolo: oh, i'm thinking of a javascript var.
[04:23:06] orolo: in an ajax success call back, data.myObj contains a JSON version of the object i want to pass to the form. how to i pass that javascript version back into rails?
[04:23:42] orolo: is where i'm missing it.
[04:24:51] jhn: just read the values from the json object.
[04:25:06] jhn: then populate the form regularly, using those values.
[04:25:28] jhn: when the form is processed and it hits your controller, the values will be in the params hash.
[04:25:43] orolo: well, i'm trying to get it into a form_for @obj; rails is helping w/ dates and so it is breaking the date up into several sections; so i'm trying to get the actual obj.
[04:26:27] orolo: the form creates a month, day, year, minute second select inputs and so i'm trying to avoid reading those back in. but maybe i'll cut my losses and do that.
[04:26:42] orolo: thanks jhn
[04:29:12] jhn: orolo: are you calling an external api using js?
[04:29:19] orolo: no, internal
[04:29:37] jhn: why don't you call it directly from rails?
[04:30:25] jhn: I'm probably not interpreting your problem correctly.
[04:30:51] orolo: hmm. yeah, i'll that; no, i think you are; i'm trying to share a form on one page for create and update and am getting confused.
[04:32:32] jhn: you made a call to an api from the front end.
[04:32:41] jhn: and got json in response from this api.
[04:32:50] jhn: now you want to send it to rails.
[04:32:58] jhn: so that you can populate a form.
[04:33:16] orolo: haha. yeah.
[04:33:30] jhn: so my solution is:
[04:34:00] jhn: instead of making a call to the api from the front end, make that call from rails.
[04:34:17] rhizome: or...just request and return a form
[04:34:18] jhn: the response will come back to rails, as json.
[04:34:43] jhn: use that json to create an object and pass it along to your form_form
[04:34:52] rhizome: forget json, just return the html for your modal
[04:35:24] orolo: ok, i'll try it again; i'm making some extra work for myself.
[04:36:24] thebay: hi, anyone have the last release of Agile web development with Rails 4. released Oct 1th
[04:38:34] xybre: thebay: http://pragprog.com/book/rails4/agile-web-development-with-rails-4
[04:39:52] thebay: xybre: yep I know it. but I mean downloaded :))
[04:40:16] xybre: If you want to steal something google it yourself.
[04:41:09] thebay: it isn't steal but sharing :))
[04:41:44] thebay: xybre: sharing is caring <3
[04:41:53] thebay: xybre: it isn't steal but sharing :))
[04:43:52] xybre: Okay, look I read the hacker manifesto, information wants to be free, I get it. You can still google it.
[04:44:40] gwillen: thebay: it's rude to ask for illegal stuff in public chat :-P
[04:45:41] rhizome: care enough to diy
[04:45:41] Radar: jhn: Did you solve your problem from yesterday?
[04:46:45] thebay: gwillen: it isn't illegal, just asking 4anyone who want share a book
[04:48:22] jhn: Radar: Yes! Thanks again for your help! I hope you don't get mad but...
[04:48:36] jhn: Remember I was using the figaro gem?
[04:48:40] jhn: I had copied everything.
[04:49:07] jhn: But the file that contained all the env/figaro variables was missing??? :-(
[04:49:11] boytoy: Would it be considered normal for ones asset precompilation to take 30+ minutes if one has 1 Intel Xeon processor with 512 MB RAM, some 64 KB of local JS and 384 KB of vendor JS?
[04:49:18] jhn: I forgot to copy it...
[04:49:50] jhn: I just scp'd that and everything worked.
[04:50:00] jhn: Sorry??? :-/
[04:51:02] jhn: Let me know when you come to NYC. I'll buy you a beer for your troubles.
[04:51:11] thebay: gwillen: k srry ;))
[04:51:23] thebay: xybre: haha k srry ;))
[05:33:15] n88: does anyone know of a tool i can use to better visualize a large xml response
[05:39:48] Radar: jhn: I'm going to be in DC at the end of this month. Maybe you can come up and say hi? :P
[05:42:51] lessless_: what do you use for autorization in rails4?
[05:58:00] michael_mbp: Radar: can I ask you a question re. chef cookbooks?
[05:58:23] michael_mbp: does this look ok to you? node.set[:databox][:db_root_password] = node.default[:storagebox][:db_root_password] if node.default[:storagebox][:db_root_password].present?
[06:02:02] michael_mbp: ah no need for the default call
[06:12:35] boytoy: yao yao anyone awakie
[06:19:18] Radar: michael_mbp: I am not here.
[06:19:24] Radar: michael_mbp: I also don't use Chef.
[06:22:26] n88: kara_sweets: what part of socal are you from?
[06:27:55] luckyruby: For my project, on branch X I added some migrations a couple weeks ago. Just now I added a couple new migrations to my production branch (needed to add some indexes for a few slow queries). When I git checkout x; git merge production, I get a conflict in my db/schema.rb for obvious reasons. How do you guys handle this type of situation in your development workflow?
[07:20:11] kara_sweets: if you write a scipt
[07:20:34] kara_sweets: can you add a help view in terminal so when someone enters and adds -h it shows the help
[07:20:54] michael_mbp: check out thor kara_sweets
[07:21:30] michael_mbp: all the rails commandline stuff is made fancy via thor
[07:21:59] kara_sweets: michael_mbp: exactly what i was looking for , thanks
[07:42:46] jrobeson: rubinus 2.0.0!
[07:51:55] jrobeson: rubinus 2.0.0 looks exciting. the standard library is made of gems.. neato
[07:56:05] michael_mbp: I've been wrangling with chef all day :S
[07:56:13] michael_mbp: just got the hang of things
[07:59:19] marjinal1st: how can i embed ruby code in json?
[07:59:52] michael_mbp: or in a ruby file do string interpolation
[08:00:09] michael_mbp: easiest is to parse a hash to JSON.
[08:00:37] michael_mbp: just becareful about the root_node, whether you want it or not.
[08:01:10] marjinal1st: thanks, i'll give it a try
[08:27:24] n88: how would i make sure that a search string coming in through params is a certain length
[08:30:47] tbuehlmann: n88, validate it yourself in a private controller methods or build up a Search class which has validations itself
[08:32:09] n88: tbuehlmann: do you see the problem in this: https://gist.github.com/n8fischer/cf140261ff657598e7b3
[08:32:28] n88: i'm getting the error undefined method `size=' for "10":String
[08:32:58] n88: ah.. = vs ==
[08:34:08] tbuehlmann: yeah, and make sure params[:search] is set, because there's no size method for nil either
[08:34:44] tbuehlmann: using `isbn_query = params.fetch(:search, '')`, for example
[08:34:57] n88: its rails 3.0
[08:35:15] n88: and i have a search form posting to the controller with the :search in params
[08:36:58] tbuehlmann: as said, have a dedicated class for the search and validate that search against the length of the search term. OR check the length as you do and react accordingly
[08:38:15] n88: i was planning on refactoring classes out once functionalit is working
[08:38:22] n88: for some reason https://gist.github.com/n8fischer/d4fabcc7df9fb9fd5a9f
[08:38:38] n88: that is not catching search terms <10 digits and redirecting back
[08:42:19] tbuehlmann: n88, do you return aften the redirect_to call?
[08:43:44] n88: tbuehlmann: https://gist.github.com/n8fischer/14db717979e96170146b
[08:43:51] n88: sorry for the ugly code, its my first app
[08:44:55] n88: the search.html.erb is sending params[:search] to that controller... i'm parsing out the :search to isbn_query and then i want to let the user know if it wasn't 10 digits
[08:49:33] tbuehlmann: n88, try this: https://gist.github.com/tbuehlmann/4ac542f0d7761560d451
[08:51:09] n88: awesome it worked...
[08:51:21] n88: whats the difference between .fetch and the way i was doing it
[08:51:31] tbuehlmann: that's not the problem
[08:51:33] n88: and why doesn't redirect_to automatically return
[08:51:34] boytoy: Anybody know why it takes like 1 hour to precompile my assets on my VPS? It's a single Intel Xeon processor with 1024 MB RAM. My stylesheet is relatively small, I only got like 5 images and my local JS is 64 KB. My vendor JS is 384 KB.
[08:51:44] tbuehlmann: heh, yeah, that was the problem
[08:51:53] tbuehlmann: it does not return, you have to do it
[08:52:06] n88: it seems like it should return ;)
[08:52:18] tbuehlmann: params.fetch(:search, '') means: return params[:search] if it is set, and if not, return ''
[08:53:03] n88: ah cool
[08:53:33] tbuehlmann: n88, it can't really return, unless it's a proc you call
[08:54:15] tbuehlmann: in other words: the method call to redirect_to can't return in the calling method
[08:54:31] n88: that makes sense
[08:54:43] n88: i think i read that redirect_to should be redirected to a fully qualified url
[08:54:47] n88: so should i use root_url
[08:54:49] n88: instead of :back
[08:56:11] tbuehlmann: yes, always use _url instead of _path in a redirect_to
[08:56:14] tbuehlmann: not sure about :back
[09:03:04] tbuehlmann: n88, redirect_to uses request.env["HTTP_REFERER"] for :back. and that's either nil or a full url, so you're safe using that
[09:04:57] n88: thanks tbuehlmann
[09:34:45] robertjpayne: Is it bad practice to create associations/tear down associations in model hooks?
[10:39:15] filp: Hey guys, quick question if anyone has any idea - I'm pushing an app to heroku, but it's complaining about the devise secret key missing
[10:39:39] filp: I'm reading the key from an ENV variable, which is set through config:add, and have set initialize_on_precompile to false
[10:47:46] michael_mbp: man what a slow night
[10:47:59] michael_mbp: ACTION wait for workmad3 
[10:48:10] michael_mbp: ACTION waits for workmad3 
[10:48:31] relix: hey guys, I can't get bourbon (.io) to work with rails asset pipeline
[10:48:37] relix: 1 line of code:
[10:48:38] relix: @include retina-image(patterns/wood_pattern, 203px 317px, $asset-pipeline: true);
[10:48:47] relix: ACTION it doesn't use the asset pipeline fingerprinting
[10:55:18] coj: from all i gather, turbolinks is turned on in Rails 4 by default, but why doesn't my new app seem to use it? it only seems to work if, for example, i do link_to with the remote: true option
[11:01:41] n88: if i'm returning an instance variable back to a user for them to verify/change attributes (in a form but i dont want them to be able to edit all the attributes) before persisting the data... should i just have hidden inputs for the attributes i don't want them to edit/see
[11:02:14] n88: or how would i make that instance variable 'live' across two separate controller requests
[11:35:45] afrodiziak: what method is used to remove a substring at specific index from a string and which page has the best api db to find this for ruby?
[11:41:10] Leighton: afrodiziak: what?
[11:41:20] willbradley: afrodiziak: i'm not sure, but https://www.google.com/search?q=ruby+remove+a+substring+at+specific+index+from+a+string and http://www.ruby-doc.org/core-1.9.3/String.html
[11:42:06] svector: why doesn't my page execute js( ie. doc.ready) when reached by clicking a link and does so when it is refreshed?
[11:42:54] svector: I'm using rails 4
[11:43:02] svector: is this a turbolinks issue?
[11:59:24] coj: can i point two belongs_tos at each other? will i regret this?
[12:35:29] wuzzzzaah: hi guys, if i have a db server on an aws ec2 instance store, what happens if i reboot it? do i retain the data on disk?
[12:37:52] ktkaushik: i suppose you should. Cannot guarantee though
[12:38:40] wuzzzzaah: my servers keep on saying *** System restart required ***
[12:39:15] wuzzzzaah: amazon page says "This will cause you to lose any data you have saved on the local instance store of the instance, and will change your internal IP (except when running in Amazon VPC)."
[12:39:28] wuzzzzaah: but a lot of people in SO say otherwise
[12:39:44] ktkaushik: + wuzzzzaah as i said, i really cannot guarantee. But restart is definitely in order
[12:40:04] wuzzzzaah: yeah. i might have to go through that then. thanks
[12:55:07] Stalkr_: webdestroya: He, I accidentally bugged the app again. I realized version 3.2.14 will fix it, so must be some bug on 3.2.6 I assume
[13:34:51] krz: in AR, when one calls User. how does it know which table in the db it is associated with? if i were to implement the same fuctionality with a class and a different db solution. should I be using a class variable?
[13:44:20] tbuehlmann: krz, rails knows it by convention, see http://api.rubyonrails.org/classes/ActiveRecord/ModelSchema/ClassMethods.html#method-i-table_name
[14:17:39] svector: Hello, can you suggest me the simplest Bootstrap gem. I don't write less or sass
[14:23:41] roar_: hello, I try to use devise's sign_in with rspec for testing but I'm getting this error: "undefined method `env' for nil:NilClass". as far as I can say it's because @request is nil. according to some google results @request is being set by rspec (after an http request?)
[14:23:54] roar_: I'm using rspec 2.4.15 and rails 4
[14:24:11] roar_: is this a bug in rspec?
[14:24:28] catom: is 202 the appropriate http status code to return to a browser when a task has been submitted to a worker for processing?
[14:25:13] bastilian: roar_: are you in a controller spec?
[14:26:12] roar_: bastilian, actually I'm in capybara's 'feature' block
[14:28:48] bastilian: roar_: https://github.com/jnicklas/capybara#gotchas
[14:31:18] roar_: bastilian, ah, ok. thanks. so there is no way to use devise's sign_in with capybara?
[14:33:32] bastilian: roar_: maybe read this: http://schneems.com/post/15948562424/speed-up-capybara-tests-with-devise
[14:41:03] dsferreira: Hi there. I'm justing wondering what would be the best way to log a rake db:seed process with capistrano. Is it ok just to send verbosity to STDOUT? Will it be displayed by capistrano? Any ideas?
[14:41:31] dsferreira: s/with capistrano/while using capistrano/
[14:47:14] roar_: bastilian, that seems to solve my problem, thank you very much!
[14:48:02] roar_: greetings from a countryman btw. ;)
[14:59:07] svector: I keep getting couldn't find file 'twitter/bootstrap' after installing bootstrap-saas-rails. I'm using rails 4
[15:01:29] henn1nk: is there a gem available that shows me, what is loading so long?
[15:07:08] AntelopeSalad: has anyone gotten "addthis" to work with turbolinks in such a way that no js errors occur in the end?
[15:11:21] someish: Why am I getting a undefined method 'int' error here: https://gist.github.com/saturday/e31bb8d62593502a51c9
[15:42:23] AntelopeSalad: is there a DRY way to introduce a new rails env (staging) and have it do exactly what the production env does?
[15:43:25] toretore: just copy production.rb
[15:43:48] tbuehlmann: and adapt the database.yml
[15:44:12] AntelopeSalad: is it as simple as making a new staging.rb file in the envs folder and setting the env up before i load rails?
[15:44:37] AntelopeSalad: nice, that will solve so many problems i'm having
[15:45:10] toretore: chances are your staging env is not going to be === production anyway
[15:46:03] AntelopeSalad: in this case i just wanted to use disqus, google analytics, and addthis with the final compiled/production assets but not use the real shortname/tracking/etc.
[15:46:19] AntelopeSalad: (unless it was really production mode)
[15:48:59] workmad3: AntelopeSalad: the even easier way to introduce a staging.rb and have it do the same as production.rb is to stick 'require_relative "production.rb" ' at the top of the file
[15:49:14] workmad3: AntelopeSalad: and then do the configure block and override anything you need changing
[15:49:46] AntelopeSalad: workmad3: thanks, that's exactly what i was hoping existed
[15:50:35] workmad3: I don't normally like the way that 'require_relative' connects two files positionally to each other, but considering that environment files are always in the same place it's ok there :)
[15:51:21] AntelopeSalad: i'm only concerned about littering my views with Rails.env checks all over, this seems really messy
[15:52:19] workmad3: don't do that
[15:52:36] AntelopeSalad: how else can i check what env is running?
[15:52:54] afrodiziak: how to show in console which environement is currently set?
[15:53:18] workmad3: AntelopeSalad: generally, you don't
[15:53:48] AntelopeSalad: disqus says it's a horrible idea to use your live username for testing
[15:53:55] AntelopeSalad: since it crawls that data
[15:53:59] workmad3: AntelopeSalad: apart from in some config loading, you shouldn't usually need to check which env you're in
[15:54:18] workmad3: AntelopeSalad: no, so you push in config data from a yml file or env vars that you set
[15:54:38] AntelopeSalad: and then set those vars in each separate env file?
[15:57:07] AntelopeSalad: seems like config/application.yaml is the place to put this stuff?
[16:14:30] tpayne84: Can anyone point me toward the relevant documentation for this issue: Record: belongs_to :user / has_one :course / has_one :client, through: :user / has_one :group, through: :user ??? on the index page for the Report I would like to have a form with selects for client, group, and user (the form, I have already made) ??? but I do not know how to make the form post action return a filtered index page. (I have the scop
[16:14:31] tpayne84: setup just don't know how to call them from the form)
[16:20:18] coj: yessss got this ancestry tree cloning method working
[16:27:12] svector: anyone fixed the "Don't know how to build task 'convert'" problem when trying to upgrade to bootstrap 3 in bootstrap-less?
[16:52:00] henn1nk: universa1: i am using now dalli for caching this big sql query???but in production it seams this doesn't work right, cause the perfomance is still slow :(
[16:55:04] AntelopeSalad: workmad3: were you able to get dhh's config gem to work?
[16:55:54] workmad3: AntelopeSalad: I've never even heard of that gem
[16:56:58] AntelopeSalad: workmad3: oh, what do you use for config variable management? i read about 10 diff blog posts but couldn't get anything to work
[16:59:03] workmad3: AntelopeSalad: sometimes configatron, sometimes I'll just add to the Rails config object after loading from a YAML file, sometimes I'll load from environment variables... really depends on how I'm deploying the project and how much config there is to manage
[16:59:26] AntelopeSalad: i wanted to use the yaml approach but no matter what i did failed
[16:59:47] AntelopeSalad: then i added them to each env.rb file specifically but they were always empty
[17:00:39] workmad3: AntelopeSalad: without giving code, I have no idea what you attempted
[17:01:05] workmad3: AntelopeSalad: all I can say is that it isn't particularly difficult
[17:01:40] AntelopeSalad: workmad3: i tried using this gem https://github.com/dhh/custom_configuration
[17:02:30] AntelopeSalad: then i also tried implementing this from a railscast , https://github.com/railscasts/085-yaml-configuration-revised/blob/master/blog-after/config/application.rb#L12 , it always error'd out saying it didn't know what "development" was
[17:02:54] AntelopeSalad: then i just tried adding config.foo = "bar" to each env file and accessing it with ENV[] but it was empty
[17:03:40] workmad3: AntelopeSalad: why would you try to access it with ENV?
[17:04:19] workmad3: AntelopeSalad: where on earth did you get the idea that adding stuff to the rails config object would affect the environment variables?
[17:04:53] AntelopeSalad: workmad3: i saw that syntax all over the place in random articles
[17:05:18] workmad3: AntelopeSalad: right... for accessing things you've set as *environment variables*
[17:05:42] AntelopeSalad: i tried accessing it with Rails.env.foobar too, then it says method not found
[17:05:58] workmad3: AntelopeSalad: right, because again *nothing* would tell you that was the way to do things
[17:06:14] workmad3: AntelopeSalad: whereas you've already linked to something that tells you *exactly* how you should access things
[17:06:20] workmad3: AntelopeSalad: if you'd just bothered to read the readme
[17:06:29] AntelopeSalad: on dhh's gem? i did that exactly
[17:06:38] AntelopeSalad: it was always an empty object
[17:06:50] workmad3: had you actually added any config?
[17:07:04] workmad3: or were you just hoping that config would magically appear?
[17:07:13] AntelopeSalad: yes, i added each key exactly like the readme said
[17:07:25] AntelopeSalad: and then i accessed it in my view using the second code snippet
[17:07:29] AntelopeSalad: and the value of it was {}
[17:07:42] workmad3: and you'd restarted the server?
[17:07:53] AntelopeSalad: so then i used a debugger to output the value of Rails.configuration.x
[17:08:05] AntelopeSalad: and it saw every key but every value was {}
[17:08:22] workmad3: well, would need to see what exactly you'd done
[17:08:40] AntelopeSalad: ok, in my development.rb file i have: config.x.google_track_page_view = false
[17:09:07] AntelopeSalad: in the view file using it i put: Rails.configuration.x.google_track_page_view
[17:09:21] AntelopeSalad: the value of that is {}
[17:10:09] AntelopeSalad: i have a few other keys too which are strings but they are also {} when i try to read them
[17:11:15] workmad3: right, well looking at the code (and then looking at the example) the idea is that you should have a namespace and then the config
[17:11:28] workmad3: config.x.google.track_page_views = false for example
[17:12:59] iwaffles: Is anyone else getting an update stream prematurely closed connection error when setting response.headers["My-custom-header"] = 33 on nginx? Not really sure if it's a simple fix or not.
[17:13:20] AntelopeSalad: workmad3: namespacing it somehow fixed it
[17:13:29] workmad3: AntelopeSalad: not 'somehow'
[17:13:42] workmad3: AntelopeSalad: the code (which is a massive 10 lines) makes it pretty clear how
[17:14:01] AntelopeSalad: his readme is pretty sparse and dhh is a smart guy
[17:14:28] workmad3: AntelopeSalad: and the test also shows how it's intended to work
[17:14:31] AntelopeSalad: it seems weird to me that he would demand a namespace because the code example made it look like namespaces were something optional for organizational purposes
[17:15:17] workmad3: AntelopeSalad: right... so you try something, then when it doesn't act like you expect you then went and read the code, right?
[17:15:59] workmad3: AntelopeSalad: or did you assume it just didn't work and just started doing random things that you had no reason to expect would work at all?
[17:16:06] AntelopeSalad: workmad3: i didn't know what to make of it, i see nothing there that make it require a second namespace
[17:16:30] AntelopeSalad: i namespaced it with .x which seemed necessary of course
[17:16:55] AntelopeSalad: what line of code says that it expects a double namespaced key?
[17:17:06] workmad3: AntelopeSalad: well, for starters config.x is a CustomConfiguration that adds new config keys through a method_missing
[17:17:23] AntelopeSalad: the problem is config.x.foobar does not work
[17:17:29] AntelopeSalad: but config.x.wtf.foobar DOES work
[17:17:38] workmad3: AntelopeSalad: and if you do 'config.x.foo_bar = "buzz" ' then the config key that gets set (to an OrderedOptions object) is foo_bar=
[17:17:59] workmad3: AntelopeSalad: or, in other words, the code that sets the config key in that class *ignores* any arguments you pass in
[17:18:15] AntelopeSalad: where do you see all of the code that's doing method_missing/etc.?
[17:18:30] workmad3: AntelopeSalad: in the github repo you linked to
[17:18:38] AntelopeSalad: the lib i'm looking at is only 1 or 2 lines of code minus the boilerplate
[17:19:02] workmad3: AntelopeSalad: yup
[17:19:06] AntelopeSalad: @configurations[method] ||= ActiveSupport::OrderedOptions.new
[17:19:11] workmad3: AntelopeSalad: yes
[17:19:31] AntelopeSalad: how does that say "listen, you need to double namespace your keys or it will break by not throwing an error but instead giving you empty values"
[17:19:36] workmad3: AntelopeSalad: that's in a method_missing
[17:20:00] workmad3: AntelopeSalad: so any method you call on config.x will end up in there
[17:20:17] workmad3: AntelopeSalad: it says that by *reading* the code and following through what it deos
[17:20:30] AntelopeSalad: there's only 1 line to read though
[17:20:52] tpayne84: I have a form that is passing some params: "user_id"=>{"0"=>"248"} ???that is what is being passed and the value of the select that holds user_is is 248 in this instance, I do not know where the 0 is coming from. More to the point, how do I pull out the 248 as the value to do stuff with. I am trying to extract it like this: user_id: params[:user_id] ??? but that is giving me a range 0..248 anyone know what I am do
[17:20:59] workmad3: AntelopeSalad: right... so follow through what it does
[17:21:09] workmad3: AntelopeSalad: one line can say a lot
[17:21:19] AntelopeSalad: it says it calls something i know nothing about
[17:21:34] AntelopeSalad: and then when i look it up on apidock it says it's deprecated
[17:21:53] workmad3: AntelopeSalad: apidock is a crap place to get deprecation info from
[17:22:05] workmad3: AntelopeSalad: or rather, you should read the 'deprecation notice' *very* carefully
[17:22:05] AntelopeSalad: http://apidock.com/rails/OrderedOptions/method_missing
[17:22:14] workmad3: AntelopeSalad: it says something completely different if you do more than skim it :P
[17:22:20] AntelopeSalad: that is the link given (#1 hit) when i googled for "active record orderedoptions"
[17:23:07] AntelopeSalad: i'm not really sure what to make of this source
[17:23:19] AntelopeSalad: i thought method_missing was built in to ruby
[17:23:20] workmad3: AntelopeSalad: first off, given the line 'ActiveSupport::OrderedOptions', why would you search for 'active record'?
[17:24:01] workmad3: AntelopeSalad: ok, so treat this as a challenge
[17:24:12] workmad3: AntelopeSalad: given the 11 lines in that file, figure out what exactly is happening
[17:24:47] workmad3: AntelopeSalad: the behaviour drops out of those lines
[17:25:00] AntelopeSalad: it seems to translate foo[:bar] = "baz" to foo.bar = "baz"
[17:25:17] AntelopeSalad: so it turns a key into a method?
[17:25:49] workmad3: AntelopeSalad: and as I said... read what you thought was a deprecation notice *really* carefully
[17:26:05] workmad3: AntelopeSalad: and keep in mind that apidock is not authoritive at all
[17:26:16] AntelopeSalad: i already got rid of that page because it was for activerecord not activesupport
[17:26:25] AntelopeSalad: the one i'm looking at now is http://api.rubyonrails.org/classes/ActiveSupport/OrderedOptions.html
[17:26:33] AntelopeSalad: and the code example made it very clear what it does
[17:27:09] workmad3: AntelopeSalad: right, so now you know what that does, understand what that gem is doing ;)
[17:27:41] AntelopeSalad: it seems to be sugar so you don't have to deal with writing typical hash keys?
[17:28:16] workmad3: AntelopeSalad: not quite
[17:28:27] AntelopeSalad: but with all that said i still have no idea why it requres 2 namespaces to function properly
[17:28:29] workmad3: AntelopeSalad: what is 'config.x'
[17:28:43] workmad3: (as in what object is it)
[17:28:57] AntelopeSalad: config.x is the result of calling CustomConfiguration::Configuration.new
[17:29:00] AntelopeSalad: which i didn't look up yet
[17:29:15] workmad3: AntelopeSalad: do you really need to look that up?
[17:29:27] AntelopeSalad: of course, i have no idea what "railtie" is or that
[17:30:07] workmad3: AntelopeSalad: surely you know what SomeClass.new does by now
[17:30:25] AntelopeSalad: yeah it makes a new instance of that class
[17:30:34] workmad3: AntelopeSalad: right... so config.x is what?
[17:30:47] AntelopeSalad: a new instance of whatever that configuration class is
[17:30:57] workmad3: AntelopeSalad: right... and you had the source for that just now :P
[17:31:13] AntelopeSalad: i'm still trying to find out what that class is tho
[17:31:27] workmad3: AntelopeSalad: so config.x is a CustomConfiguration::Configuration instance... so what is config.x.something ?
[17:31:31] relix: hey guys, I have a javascript file that embeds a SWF file, however I want that SWF file passed from the asset pipeline - i.e. it has a fingerprint
[17:31:58] relix: what are my options to do this? I'm thinking of using Gon to pass the correct path on every request, and then read that Gon variable in the javascript file
[17:32:05] AntelopeSalad: workmad3: i'm not really sure
[17:32:20] AntelopeSalad: i'm still trying to google what that configuration class is, not getting any hits
[17:32:39] workmad3: AntelopeSalad: that configuration class is in the gem
[17:32:45] workmad3: AntelopeSalad: it's the 11 lines of code you had open
[17:33:05] AntelopeSalad: ah, i thought it was something built into railtie
[17:33:50] AntelopeSalad: config.x is just a hash then but with the nicer key syntax?
[17:34:12] workmad3: you had a file open that declared a class called 'CustomConfiguration::Configuration' and you thought that when an instance of this was created elsewhere that it was something *else*?
[17:34:31] AntelopeSalad: yes because i was looking at each file one at a time, i didn't have them side by side
[17:36:12] AntelopeSalad: i think i see the problem now
[17:36:42] AntelopeSalad: config.x.foo = "bar" is always empty because no value was ever supplied?
[17:37:19] workmad3: AntelopeSalad: also consider what would end up in the @configurations hash for that call
[17:37:37] AntelopeSalad: you would end up with foo[:bar] = empty?
[17:38:05] workmad3: AntelopeSalad: no
[17:38:38] workmad3: AntelopeSalad: you'd end up with the key @configurations[:foo=] ||= ActiveSupport::OrderedOptions.new
[17:39:45] AntelopeSalad: this is a lot of code to fit in my head at once, i already forgot what that orderedoptions did
[17:41:53] AntelopeSalad: workmad3: thanks for trying to explain it
[17:42:01] AntelopeSalad: too many new concepts to lookup to fully get it
[17:43:21] workmad3: AntelopeSalad: the main thing is that you want to be setting your config on an ActiveSupport::OrderedOptions
[17:43:29] workmad3: AntelopeSalad: because that has the behaviour you want
[17:43:41] workmad3: AntelopeSalad: config.x.whatever gets you one of those
[17:44:07] workmad3: AntelopeSalad: so you then need to set your config on that... so config.x.whatever.my_config = "foobar"
[17:44:44] AntelopeSalad: so the .x was just to separate it from the regular config.some = "value" stuff
[17:45:08] workmad3: the .x was a place to put an object that would create AS::OrderedOptions objects on-demand
[17:46:05] AntelopeSalad: btw if you wanted a set of config options to be the same for 3 envs but different for 1, would you drop the 3 identical versions in application.rb and overwrite it in production.rb?
[17:46:10] AntelopeSalad: or is there a better spot for general config options
[17:46:51] AntelopeSalad: maybe config/initializers/app_settings or something?
[17:47:38] workmad3: AntelopeSalad: I'd probably create a config/something.yml file, and then add to the rails config option with 'config.something = YAML.load_file(Rails.root + "config/something.yml")[Rails.env]'
[17:48:04] workmad3: AntelopeSalad: and then in the yml file, you can have production:, development:, test:, etc settings
[17:48:15] AntelopeSalad: how would you read the values out?
[17:48:25] AntelopeSalad: that was the part i was stuck on when i tried to follow the railscast
[17:48:29] workmad3: AntelopeSalad: Rails.configuration.something["foobar"]
[17:48:55] AntelopeSalad: you don't see any benefits with dhh's gem?
[17:48:58] workmad3: AntelopeSalad: i.e. the same as you would with that dhh gem
[17:49:49] workmad3: AntelopeSalad: if I was setting directly in the config/environments/*.rb files, I'd consider dhh's gem now I know about it
[17:50:28] workmad3: AntelopeSalad: but I probably wouldn't bother when loading from a yaml file, because I cba to recurse through the loaded hash and symbolize everything/turn it into OrderedOptions objects
[17:50:50] relix: hey guys, in the rails docs it says
[17:51:01] relix: regarding asset pipeline: "Any path under assets/* will be searched."
[17:51:13] relix: however, I have a folder assets/swf, and it is not searched unless I add it to the config.asset_path array
[17:51:17] AntelopeSalad: workmad3: are you saying it will be a bottleneck?
[17:51:25] workmad3: AntelopeSalad: no
[17:51:28] relix: is this new in rails 4, because I'm still using 3, or am I or the guide wrong?
[17:51:47] workmad3: relix: no, you don't need to add it explicitly, even in rails 3
[17:52:02] workmad3: relix: however, new paths won't get searched until you restart the server
[17:52:06] relix: workmad3 so then there's some other problem
[17:52:11] relix: workmad3 yeah I restarted already
[17:52:15] relix: workmad3 thanks, I'll keep looking
[17:52:46] workmad3: AntelopeSalad: in no way did I mention bottlenecks or performance of any kind
[17:52:59] AntelopeSalad: workmad3: you said you couldn't be bothered to do everything that his gem is doing
[17:53:02] relix: workmad3 actually are you sure? because the rails guides does say only the images, javascripts and stylesheets dirs are searched by default in rails 3
[17:53:04] relix: http://guides.rubyonrails.org/v3.2.13/asset_pipeline.html
[17:53:10] workmad3: AntelopeSalad: no, I didn't say that
[17:53:29] workmad3: AntelopeSalad: I said I couldn't be bothered to do something that is completely separate to what that gem provides
[17:53:49] workmad3: relix: I'm pretty sure
[17:54:10] AntelopeSalad: it seems clumsy to me that with the non-yaml approach you have to edit multiple files
[17:54:14] workmad3: relix: I've added lots and lots of app/assets subfolders in a rails 3.2 project and never had to add them to the asset_path searches ;)
[17:54:45] workmad3: relix: the question is... how are you trying to include it?
[17:55:22] relix: workmad3 I'm using view_context.asset_path("swf/main.swf") (i'm sourcing it in the controller)
[17:55:34] workmad3: relix: right, that's the problem
[17:55:43] workmad3: relix: app/assets/swf is a top-level path
[17:55:57] workmad3: relix: same as app/assets/images, app/assets/stylesheets, etc
[17:56:15] relix: workmad3 I can remove "swf/" prefix?
[17:56:26] workmad3: relix: s/can/should ;)
[17:56:28] relix: yep, that did the trick
[17:56:31] relix: thanks workmad3 !
[17:56:44] workmad3: relix: same behaviour as app/assets/images, etc
[17:56:51] relix: yep, makes sense
[17:57:31] localhost3000: hey guys - trying to debug a dynamic nested fields_for where the :child_index attribute is being ignored. any thoughts on likely cause? same link_to_add_fields helper is working just fine for other models.
[18:01:41] AntelopeSalad: workmad3: do you know of any easy fix so that you can put your config.x.foo.bar values in the application.rb rather than each env file?
[18:03:12] localhost3000: hmm interesting. ok. i had overridden the association method on the model and that bricked the :child_index function in the form...odd
[18:04:50] localhost3000: e.g. User has_many :books ... def books {super.active} end
[18:05:03] rushed: AntelopeSalad: if you look in application.rb you'll probably see several examples of setting config items
[18:05:59] AntelopeSalad: rushed: yeah, except in this case with dhh's gem the values do not get set
[18:06:31] rushed: AntelopeSalad: have you gisted the case you're dealing with?
[18:07:18] AntelopeSalad: no, because we just spent the last while talking about using his gem
[18:07:19] workmad3: AntelopeSalad: have you tried it since you realised you were using the library wrong initially? :P
[18:08:25] AntelopeSalad: yeah i dropped it in and restarted the server
[18:11:23] sarmiena_: I'm working on an engine-based gem right now. seems the gem's own views don't have access to its custom helper methods. not sure where to start debugging
[18:16:21] naquad: could somebody point me to document describing new things in rails 4.0 and migration from 3.2?
[18:16:32] rushed: sarmiena_: main_app.some_helper & engine_name_here.some_helper
[18:27:05] rhizome: i'm not afraid to say it, i'm going to use active_admin in a second project
[18:40:29] banisterfiend: if i already have a model called Role, can i still create a role scaffold?
[18:40:58] banisterfiend: it's seeming to error out for me (breaks on 'migration already exists')
[18:40:58] banisterfiend: but i'd like to generate the controllers and views
[18:45:43] coj: i ran into that issue today, banisterfiend, and i ended up creating the controller and views manually
[18:46:26] tbuehlmann: banisterfiend, there should be a scaffold_controller generator. like, rails g scaffold_controller roles
[18:46:51] coj: ...cool
[18:47:49] coj: is active_admin any good for creating a general management interface? i've installed rails_admin but i suspect it's not really meant to be customized or offered to all users
[18:48:40] rhizome: banisterfiend: there's an option --skip-migration or something
[18:49:04] rhizome: coj: depends on what you mean
[18:49:07] sarmiena_: rushed: i'm not sure what you mean. is that a config?
[18:54:19] sarmiena_: rhizome: poking around on the active_admin demo. seems wicked slow on a per-request basis. can't see the logs??? but you think there are some optimization concerns?
[18:54:50] sarmiena_: i'm assuming it's being hosted on a free heroku account, but once it's loaded up, it should be decently quick
[18:56:23] rhizome: no idea. seems to work fine for me so far.
[18:57:18] rhizome: i don't use heroku
[18:58:00] sarmiena_: rhizome: nice. you have a good number of records? like 2k+?
[19:03:39] banisterfiend: does 'belongs_to' do anything other than just putting a method on the model to access the other one? so, if i have a join model, i could potentially leave off the 'belongs_to' ? (if i didn't care about accessing the parent model from the join model)
[19:06:51] sarmiena_: banisterfiend: yes. you can leave off relationship declarations in any model. they are just there for accessibility to the relationship from/through that specific model
[19:07:14] sarmiena_: banisterfiend: also, are you drunk yet?
[19:08:37] henn1nk: can i clear the whole cache via command? (memcached/dalli)
[19:11:20] tbuehlmann: should be something like Rails.cache.clear
[19:15:11] rhizome: sarmiena_: nope, small sites only so far
[19:24:05] banisterfiend: sarmiena_ thanks, but why are you asking if i'm drunk? :)
[19:24:35] sarmiena_: banisterfiend: hah. you've helped me a few times in ruby channel. had claimed to be drunk
[19:25:03] banisterfiend: well it is saturday night, maybe i should think about it.. :)
[19:26:18] sarmiena_: hmmm not a bad idea
[19:46:09] digitalcake: I'm trying to work on the rolify gem and the CLI says its passing build but I'm getting failures on that same commit and branch. Has anyone else dealt with this type of issue before?
[19:55:28] Xander1: anyone familiar with Devise Invitable gem?
[20:01:34] Matip: I'm getting render_to_string does not exist, from a view
[20:01:47] Matip: is that correct? why can't I use it?
[20:07:02] rushed: sarmiena_: no, it's how you explicitly access helpers from an engine or main app from views which may or may not be overwritten (perhaps I misunderstood your question) :)
[20:12:25] henn1nk: why is searched the constraint Price? https://gist.github.com/henn1nk/6845514#file-gistfile1-txt-L1
[20:14:26] henn1nk: workmad3: i just created a controller manage_prices_controller.rb ??? but i didn't created a model price (because i don't want it) but rails seems to search the model?
[20:14:34] workmad3: henn1nk: ah no
[20:14:45] workmad3: henn1nk: that's your CanCan load_and_authorize_resource line
[20:15:03] henn1nk: workmad3: ah
[20:15:10] workmad3: henn1nk: you've asked CanCan to find a Price model and authorize against it ;)
[20:15:21] henn1nk: workmad3: ok :)
[20:16:39] metus_violarium: Hello, people, do anybody know book or another material about testing (RSpec), and it's desirable to be free
[20:18:24] csaunders: metus_violarium: like TDD in general (how to do it, etc.)
[20:18:28] csaunders: or how to use RSpec?
[20:20:10] metus_violarium: about TDD in general. But I use RSpec - so it's more useful for me. I'm looking for "tips and tricks".
[20:20:22] csaunders: what about this? http://betterspecs.org/
[20:20:38] csaunders: I personally like descriptive test names??? but whatever, I'm open to suggestions
[20:21:56] workmad3: csaunders: I violently disagree with the first 'tip' there
[20:22:12] csaunders: workmad3: same
[20:22:20] csaunders: minus the violence
[20:22:28] workmad3: csaunders: that said, the 'bad' examples are still bad... but the 'good' examples are also atrocious :)
[20:22:36] metus_violarium: Thank you. Sometimes it's too difficult to decide what I shoul test or not. In one project I had more test-code than work-code
[20:22:49] csaunders: metus_violarium: That's not necessarily a terrible thing
[20:22:57] csaunders: it's a fine balance
[20:23:14] csaunders: if you can avoid rails loading testing is kinda awesome
[20:23:21] csaunders: rails loading during testing*
[20:23:26] workmad3: metus_violarium: I have book suggestions for help on some of that, if you're interested :)
[20:23:35] csaunders: workmad3: gimmegimmegimmegimmegimmegimmegimmegimmegimmegimmegimmegimmegimmegimmegimme
[20:23:52] metus_violarium: workmad3: I'm interested)
[20:23:55] workmad3: csaunders: I suspect you've got most of them already ;) but here goes
[20:24:27] workmad3: TDD: By Example (Kent Beck), The RSpec Book, xUnit Test Patterns, XP Explained
[20:24:42] workmad3: I'm also reading 'Rails Test Prescriptions' atm, still undecided on it
[20:25:18] csaunders: workmad3: I've only read the Beck one
[20:25:27] csaunders: I'll check out the others though
[20:25:42] csaunders: currently working through a bunch of Grimms books (slow reader)
[20:25:45] workmad3: csaunders: xUnit Test Patterns is a hefty tome
[20:26:02] csaunders: I've found most stuff from that publisher pretty hefty
[20:26:05] workmad3: csaunders: but it's a really good narratives/pattern type book for tests
[20:26:19] workmad3: csaunders: it's hefty even by their usual standards ;) ~1000 pages
[20:26:38] csaunders: Read through the first section of DSLs??? then figured I was done. The rest looked like reference
[20:27:11] metus_violarium: When I was starting, I read Michael Hartl. And he didn't use controller tests, do you?
[20:27:40] yekta: I'm setting up a new production environment, but my assets keep 404'ing, running nginx, unicorn with rails 4 and ruby 2 - I've set config.serve_static_assets = true, is there something else I need to do?
[20:27:45] csaunders: metus_violarium: Errr what?
[20:28:19] csaunders: metus_violarium: normally yes. But I'm typically building out APIs / backend stuff, so controller tests are kinda necessary
[20:28:59] csaunders: if your controllers are effectively proxy calls to your AR methods, then maybe not?
[20:29:15] csaunders: but once you get to anything real (logged in users, ownership, etc) you probably need some controller tests
[20:29:27] metus_violarium: csaunders: I mean, that I saw 3 types of tests: unit-tests for models and other your own stuff, controllers tests and integration tests
[20:29:38] sarmiena_: can someone help me figure out why my block isn't returning expected results? http://hastebin.com/yewujivevi.vala
[20:29:50] csaunders: normally I don't do integration tests :/
[20:30:14] metus_violarium: And integration tests, sometimes, is possible to use instead of contoller tests
[20:30:20] csaunders: though when I've run into some really messed up situations I've done integration tests that brought up some really interesting bugs
[20:30:37] csaunders: metus_violarium: From my understanding they are more flow based
[20:30:41] yekta: My css and JS is loading but images and fonts that aren't loading on my production env, they are 404'ing. what might be wrong in this scenario?
[20:30:44] csaunders: I click here, fill out this form, modify this doodle, etc
[20:30:53] csaunders: after each thing the world is in this state
[20:31:08] csaunders: yekta: Deployed to heroku?
[20:31:17] csaunders: oh sorry??? just saw
[20:31:24] yekta: csaunders: no, a private linux server
[20:31:34] csaunders: ummm??? is your nginx config setup properly
[20:31:49] csaunders: think you might need to add something to nginx to point to your public directory
[20:31:52] yekta: csaunders: just a sec I'll gist it
[20:32:23] metus_violarium: csaunders: thank you. Haven't you tried cucumer for unit-testing, have you?
[20:32:33] csaunders: metus_violarium: nah
[20:32:46] yekta: csaunders: https://gist.github.com/dwickwire/2521589844047f5d22ee
[20:33:27] metus_violarium: Sorry, what does mean "nah"?
[20:33:36] csaunders: metus_violarium: no I haven't
[20:33:58] metus_violarium: Sorry for my English
[20:34:01] csaunders: yekta: Hmmm...
[20:34:13] csaunders: metus_violarium: nah it's cool :)
[20:34:29] csaunders: lol, I apologize to the person named cool
[20:35:06] metus_violarium: And one more question: how do you deal in tests with internationalization?
[20:35:21] yekta: csaunders: hang on, I just realized that my code isn't using the config.assets.compile true change from my latest deploy???
[20:35:44] csaunders: metus_violarium: there's a way to do it, you effectively just verify that the correct internationalization key is used
[20:35:53] csaunders: sadly, I haven't worked on internationalized apps :(
[20:35:56] workmad3: csaunders: yeah, xUnit is similar to DSLs (and Refactoring), about 100 pages or so of narratives, the rest is a patterns catalog that's good to skim through and know what's there, and delve into on-demand
[20:37:10] csaunders: sarmiena_: long shot, but I *think* you don't need to take in &block as an argument if you are going to do block_given?
[20:37:29] csaunders: I think you can just take in an argument, and if a block is given just yield
[20:37:40] sarmiena_: csaunders: it was a scoping thing. i changed it to block ? block : prefix
[20:38:53] csaunders: also, I think you could just do def speak(prefix=nil, &blk); puts "#{(blk ? blk.call : prefix)} bark bark"; end
[20:38:53] metus_violarium: csaunders: I have not worked with them to, but I use l18n for one language :) And in tests I just use l18n too - not "Submit", but l18n.t('buttons.submit') - is it normal. What do you think?
[20:39:14] workmad3: metus_violarium: I've done that before
[20:39:19] csaunders: metus_violarium: I cannot say since I don't have any experience
[20:39:30] workmad3: metus_violarium: tbh, I'm not sure what's best there... guess it depends on what aspects you want to test
[20:40:19] metus_violarium: workmad3: filling forms. check, that links send you in the right way and etc.
[20:40:27] workmad3: metus_violarium: I went for using I18n in my expectations mainly because it helped my reduce the fragility of the tests... but I mostly now make sure that certain page areas are present rather than exact text
[20:42:13] workmad3: metus_violarium: so for links, I'd do something like 'page.find("[data-role='site-home']").click' rather than 'click_link "Home" ' or 'click_link I18n.t(:home_link)'
[20:43:13] metus_violarium: workmad3: hmm, it's sounds reasonable
[20:44:27] delinquentme: is $ ruby supposed to do something?
[20:44:34] delinquentme: on say a properly built RVm installed system?
[20:46:58] csaunders: delinquentme: You trying to find out what active version of ruby you have?
[20:47:08] csaunders: ruby --version
[20:47:19] metus_violarium: workmad3: so, do you mean, that if you test functional part, you should use something sensible - not just text. But when do you test content (names and somebody else), it's better to use exact text for all languages?
[20:47:31] csaunders: rvm should also have a way of listing your installed rubies and which one is active
[20:47:36] rushed: delinquentme: ruby -v => ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.3.0] also "rvm list"
[20:47:42] henn1nk: i don't understand, why my controller action is not found: https://gist.github.com/henn1nk/6845832#file-gistfile1-txt-L1
[20:48:01] boytoy: How long does it take you guys to precompile your assets?
[20:48:22] workmad3: metus_violarium: well, apart from that I don't test content that much
[20:49:29] metus_violarium: workmad3: that's all, thank you very much)
[20:49:31] workmad3: metus_violarium: at least not in a TDD style, and I wouldn't automate them much... tests for content are massively fiddly and brittle, or the end up in a situation where you ensure that something is there, but you don't test that it's what you really wanted
[20:50:16] henn1nk: boytoy: several seconds
[20:50:30] rushed: henn1nk: quickly glancing at your routes I don't see manage/basic_articles/change_price defined??? what url did you request & which route do you think should be handling it
[20:50:38] boytoy: henn1nk: My asset precompilation takes about an hour on an Intel Xeon VPS with 1024 MB RAM. Is that normal?
[20:50:45] workmad3: boytoy: anywhere from seconds to minutes, depending on how much I have there
[20:50:52] rushed: boytoy: does it sound normal to you?
[20:50:56] boytoy: henn1nk: While I do have about 400 KB of JS, I doubt that should be a factor.
[20:51:20] workmad3: boytoy: hmm... no, that doesn't sound normal
[20:51:26] henn1nk: rushed: https://gist.github.com/henn1nk/6845832#file-routes-rb-L20
[20:51:34] boytoy: Seconds to minutes huh.
[20:51:35] csaunders: boytoy: We have a very large batmanjs app at Shopify and it takes *maybe* 5 minutes
[20:51:51] workmad3: boytoy: the most extreme I've heard of was 45 minutes on a decent machine (6 hours on a low-powered AWS box) and that was megabytes of assets
[20:51:51] rushed: boytoy: peel that Xeon sticker back a little, maybe it actually says TRS-80
[20:52:16] workmad3: 9000 files, compiling multiple different templates for a site-builder
[20:52:33] boytoy: Okay I definitely need to contact my ISP then
[20:52:44] henn1nk: rushed: so should be defined :/
[20:52:48] sarmiena_: boytoy: i had same problem when i migrated from rails 3 -> 4
[20:52:56] workmad3: boytoy: any idea what your IO bus is like on that machine?
[20:53:08] workmad3: boytoy: asset compilation is pretty harsh on IO
[20:53:10] sarmiena_: i had a crap load of images that i wasn't using. so i removed them and brought it down to 25 minutes
[20:53:30] boytoy: workmad3: It's a http://transip.eu Blade VPS, that runs KVM virtualization on Linux to provide me with the OpenBSD operating system
[20:53:40] boytoy: workmad3: Wait, don't you use OpenBSD too?
[20:53:47] boytoy: I seem to recall
[20:53:48] workmad3: boytoy: nope
[20:53:54] rushed: henn1nk: no, "url" => "destination", options
[20:54:12] rushed: henn1nk: you're saying a matching destination exists so it should work, that doesn't follow
[20:54:15] henn1nk: rushed: u mean in my html file?
[20:54:16] boytoy: sarmiena_: Cool, well, I'm using this CSS sprite so I only really got one image :P
[20:54:24] rushed: henn1nk: no, in routes.rb
[20:54:26] workmad3: boytoy: so, you're using virtualized disk IO
[20:54:42] csaunders: henn1nk: Use "url", to: "controller#action"
[20:54:46] boytoy: workmad3: Sounds about right..
[20:54:50] henn1nk: rushed: get '/change/prices/basic_article/:id' => 'manage/basic_articles#change_price', as: 'change_prices_basic_article' is this a wrong syntax?
[20:55:09] workmad3: boytoy: I assume that your block devices are really files on the host OS rather than being direct hardware on partitions?
[20:55:40] boytoy: workmad3: That's what causing this issue you think?
[20:55:59] rushed: henn1nk: what url did you request?
[20:56:02] boytoy: makes sense what you say though
[20:56:02] workmad3: boytoy: it's certainly going to be contributing... potentially quite significantly
[20:56:07] sarmiena_: workmad3: i have similar setup as boytoy, but using proxmox/kvm with VirtIO on direct hardware partitions
[20:56:16] workmad3: boytoy: most forms of compilation are very IO heavy
[20:56:24] sarmiena_: so???. just as a reference
[20:56:26] henn1nk: rushed: = form_tag change_prices_basic_article_path, method: :get, remote: true do
[20:56:48] rushed: henn1nk: what is the text of the url you requested?
[20:56:53] sarmiena_: furthermore, compilation takes just as long on my personal machine
[20:56:58] rushed: henn1nk: not the helper you used to generate it :)
[20:56:59] sarmiena_: boytoy: workmad3 ^
[20:57:05] boytoy: hmmm.. so what should I tell my ISP? that I wish to cancel my account? :D
[20:57:06] workmad3: boytoy: can you precompile locally on a dev machine with a fast HDD?
[20:57:13] henn1nk: rushed: don't know, cause
[20:57:15] workmad3: boytoy: or an SSD?
[20:57:17] boytoy: or should i demand a faster setup to make up for this
[20:57:50] henn1nk: rushed: but the helper should do the work for me or not? Oo
[20:58:01] boytoy: workmad3: I can try. All i have is a 2011 macbook pro with windows 7 running openbsd inside virtualbox
[20:58:35] workmad3: boytoy: no direct hardware dev setups?
[20:58:56] boytoy: workmad3: unfortunately no
[20:59:04] shvelo: inception
[20:59:17] boytoy: workmad3: but.. my coworker says the same as you that our app only takes a couple of minutes to precompile
[20:59:25] boytoy: shvelo: hehe
[20:59:47] boytoy: anyway thanks guys im gonna write a little letter to my isp here
[20:59:49] boytoy: appreciate it!
[20:59:50] workmad3: boytoy: so it's likely an issue with the hardware setup?
[21:00:00] workmad3: boytoy: you could always set up a deploy chain that precompiles locally
[21:00:04] boytoy: yup it's gotta be
[21:00:13] boytoy: interesting..
[21:00:16] sarmiena_: boytoy: before writing a letter about something you don't know much about, probably should try locally
[21:00:34] shvelo: indeed, most indeededly
[21:01:00] boytoy: sarmiena_: gonna try now
[21:01:08] workmad3: boytoy: also worth checking the terms you agreed with your ISP to see if you have any agreed upon IO performance metrics
[21:01:15] henn1nk: rushed: i just don't see what is the problem there :/
[21:01:25] boytoy: workmad3: great idea..
[21:01:49] workmad3: boytoy: otherwise you don't have firm ground for a complaint :P
[21:02:27] sarmiena_: workmad3: but to drag this on a little longer. i was here on IRC a couple of days ago asking same question. IO shouldn't me a problem when using new MBP & making sure not much else is using IO
[21:02:47] sarmiena_: each png took 250ms to move over
[21:02:53] sarmiena_: sometimes 500ms
[21:03:22] boytoy: workmad3: you guys are my firm ground
[21:03:29] boytoy: or rather, cushion if i fall
[21:03:31] sarmiena_: coupled with rails 3.2 doing precompile like 10 mins
[21:03:37] boytoy: i checked my tos, no mentioning of io there
[21:03:40] sarmiena_: 1 hour doesn't seem right
[21:03:53] workmad3: sarmiena_: that does seem odd
[21:04:05] boytoy: they recently had a strange problem though
[21:04:23] boytoy: just a simple su took like 1 minute, they blamed it on hardware issues and moved me to another box so
[21:04:27] henn1nk: rushed: ah omg found it
[21:04:29] boytoy: i guess this is all part of the same game
[21:04:30] sarmiena_: workmad3: unfortunately asset pipeline is still a black box for most people
[21:04:32] workmad3: sarmiena_: large images could cause slowdowns, as they need loaded, hashed, etc.
[21:05:00] sarmiena_: yeah. still doesn't explain 600% time increase after upgrade with no asset changes
[21:05:23] workmad3: sarmiena_: but seems odd that moving from 3.2 to 4 caused slowdowns, as the rails 4 pipeline does a lot less work (doesn't recompile the same assets, only recompiles changed files, etc.)
[21:05:48] sarmiena_: yeah. what turbo-sprockets used to be i think
[21:05:55] sarmiena_: i'll keep poking about
[21:05:58] workmad3: the first one is in relation to the 3.2 pipeline always precompiling assets with and without digests
[21:07:38] workmad3: sarmiena_: yeah, turbo-sprockets-rails3 hasn't been ported to rails 4 because rails 4 does pretty much everything it used to do ;)
[21:08:17] workmad3: sarmiena_: so yeah... odditty
[21:08:44] workmad3: sarmiena_: /wi 8
[21:09:59] gabeodess: Hello, I am having a strange issue with RVM where I have a gem set checked out, and when I list my gems it shows that they are all there, however, if I try to access one, say with `rails -v` it says the gem does not exist and that I need to install it. Does anyone have an idea of what I could be missing here?
[21:10:00] gabeodess: https://gist.github.com/CitySprout/b82b92d9e0869875b1e9
[21:12:10] honestly: Hello rails. I'm a relative rails newbie, just hacking around on stuff, not starting from the ground up (as I maybe should, but that isn't possible right now). I'm duk3luk3 in this PR discussion: https://github.com/gitlabhq/gitlabhq/pull/5271/files I'm wondering if I'm missing something - I don't see the possible security problem I might be causing.
[21:12:56] boytoy: workmad3, sarmiena_, how does this sound:
[21:13:05] boytoy: "You recently had an issue with the storage server behind my BladeVPS causing simple Unix commands to take several minutes to execute. While it appears this issue is mostly gone, there is still something odd going on."
[21:13:16] boytoy: "I run this simple Ruby On Rails app, and precompiling my assets (http://guides.rubyonrails.org/asset_pipeline.html) - an operation that should only take seconds to minutes - takes about 1 hour on my BladeVPS."
[21:13:28] boytoy: "Are there any ways to remedy this?" and "Thank you." :)
[21:13:53] boytoy: what y'all think? i didnt mention the IO part as im sure they know their stuff
[21:14:07] workmad3: boytoy: are they likely to drop your account or cause you agro for sending the email?
[21:14:18] workmad3: boytoy: otherwise, can't hurt ;)
[21:14:22] boytoy: workmad3: no they are very pleasant people :)
[21:17:27] boytoy: workmad3: is this IO thing likely to impact performance once i start getting millions of visitors?
[21:17:47] rushed: gabeodess: it looks like that error is saying rubygems is too old (not that the rails gem is missing) you might want to find a current setup/getting started guide for your os of choice that covers getting RVM (or a similar tool) and other tools running before you get started (I believe you can substitute ruby 2.0 for 1.9 in http://ryanbigg.com/2011/06/mac-os-x-ruby-rvm-rails-and-you/ if desired)
[21:18:01] rhizome: once you start getting millions
[21:24:38] amccloud: Should acceptance test use route helpers?
[21:25:20] rushed: honestly: a non-admin submitting a form that updates the user (say one that doesn't even have an admin field) would be able to set the admin flag along with other mass-assigned fields
[21:26:00] honestly: rushed: how?
[21:26:14] rhizome: mass-assignment means it can be set directly from params
[21:26:20] honestly: the field is only acessible using the admin role
[21:26:32] rhizome: unless it isn't
[21:27:04] honestly: (yes, it's hard to see with the discussion in between, but the formatting was already that way)
[21:27:19] rhizome: as long as the role facility is working properly
[21:27:35] honestly: well... yes
[21:28:13] honestly: a user should not be able to change their own projects limit or group creation privilege
[21:28:27] rhizome: yet another assumption
[21:29:05] honestly: not an assumption
[21:29:12] honestly: that's how it's intended to work
[21:29:41] honestly: so the alternative is to file a bug and suggest that attr_accessible list is removed entirely
[21:31:10] rhizome: intents are not infallible
[21:31:49] honestly: so do you think the attr_accessible line should be removed entirely?
[21:33:46] rubyracer: how to pass multiple parameters to a rails controllers
[21:38:44] rushed: rubyracer: context, you forget to include any :)
[21:41:53] rhizome: honestly: i dunno man, but admin would seem to be a special case whatever the rationale for the others.
[21:42:13] rhizome: hard for me to get very excited about it
[21:42:20] honestly: yeah, I guess I can see that
[22:35:57] jb41: where should I put my module, which is used by one of the models. /lib/assets?
[22:36:27] AntelopeSalad: does anyone know if the default disqus snippet works as is with turbolinks?
[22:41:45] pontiki: jb41: under lib is a good spot, but not lib/assets
[23:05:13] boytoy: workmad3: yo welcome back
[23:05:38] boytoy: as i was asking right before you pinged out
[23:05:52] boytoy: workmad3: is this IO thing likely to impact performance once i start getting lots of visitors?
[23:06:17] boytoy: (i sent the letter but i doubt i'll get a reply before monday)
[23:07:16] amccloud: Radar: you around?
[23:29:53] jb41: pontiki: ok, thx
[23:47:14] sarmiena_: ok so i'm working on galetahub/ckeditor to try to bring it up to date with rails 4, but running into an issue with Engine isolation
[23:47:35] sarmiena_: if the engine's controller inherits from ::ApplicationController, it has no access to it's own Engine helpers
[23:47:44] sarmiena_: how do i add these in?
[23:53:00] sarmiena_: so the result is, the engine's templates cannot call methods under ckeditor/app/helpers
[23:54:20] pontiki: a simple include doesn't work?
[23:54:47] pontiki: probably not...