« Back to channel list

#RubyOnRails - 23 April 2014

« Back 1 day Forward 1 day »
[00:04:08] ner0x: Any gems that will allow me to automatically generate images or urls based on size/text/border type?
[00:18:33] brandoncordell: What's the best way to build a form for a has_many who's columns are only 'key' and 'value'.
[00:28:44] rhizome: same as any other form. what's the complication?
[00:42:30] hnanon: Radar: there?
[01:05:10] drale2k: Did anyone watch the Railsconf opening Keynote today? I found the stream on justin.tv but it starts when dhh already talks. Can anyone tell me how much into the talk this is http://www.justin.tv/confreaks/b/522101045
[01:12:53] s2013: drale2k, yeah
[01:13:18] s2013: drale2k, i think that about halfway through
[01:13:27] drale2k: s2013: oh wow ok
[01:13:34] drale2k: then i will wait for the video
[01:13:35] s2013: im at railsconf
[01:13:43] s2013: the talk was about hour and half or so
[01:13:46] s2013: maybe a little less
[01:13:58] drale2k: how is it going there
[01:14:16] s2013: pretty good. attended some interesting talks. met some cool people. im back at my hotel now doing work though
[01:15:01] s2013: i just wished they stretched it out for the entire week instead of tues-fri. that way they couldve spread out some of the talks a bit more o well
[01:15:03] sevenseacat: i'd love to attend railsconf... one day
[01:15:08] s2013: you should
[01:15:15] s2013: i just hope they do it in nyc one day. i ihghly doubt it though
[01:15:24] sevenseacat: one day when u save up all of my pennies
[01:15:36] s2013: im planning a pretty big event this summer. getting sponsors lined up now
[01:16:14] s2013: well sevenseacat its worth it imo.
[01:16:27] s2013: just make it part of your us trip cause biggest expense would probably be airfare
[01:17:03] drale2k: all good events are in the US
[01:17:09] s2013: where are you
[01:17:16] drale2k: in Austria
[01:17:26] s2013: gday mate
[01:17:32] s2013: jk. how is the rails community there?
[01:17:42] drale2k: there is almost none heh
[01:17:46] s2013: are you in vienna?
[01:17:47] drale2k: we got 8 mil people
[01:18:04] s2013: might go this summer but most likely next summer
[01:18:11] s2013: i wanna attend the classical music festival there
[01:18:13] drale2k: really? nice
[01:18:27] s2013: i like classical music and i have tons of friends in austria
[01:19:19] drale2k: rare to see someone come to vienna from overseas
[01:19:43] s2013: im sure you get tons of visitors.
[01:19:50] s2013: i wouldnt mind living there for a bit either.
[01:20:03] drale2k: yeah we have a lot of tourists but not from IRC hah
[01:20:23] s2013: we are people too. . i think
[01:20:26] drale2k: it is a really good living standard, i think we even won a price recently
[01:20:38] s2013: yeah vienna is usually ranked one of the top cities in the world to live in
[01:20:43] s2013: but i am not a fan of those rankings
[01:21:04] drale2k: where do you live, in Chicago ?
[01:21:10] hnanon: How can I set a default attribute when creating a object?
[01:21:19] s2013: drale2k, no, nyc
[01:21:23] s2013: hnanon, what do you mean
[01:21:36] s2013: i also live in texas drale2k i split my time in between
[01:21:40] hnanon: When creating a company I have nested user attributes.
[01:21:52] s2013: you can set default value when creatin gmigration
[01:21:54] hnanon: One of the fields is "role."
[01:21:55] s2013: if thats what you are talking about
[01:22:11] hnanon: I want to set the first user's role to admin.
[01:22:16] s2013: do it from the console
[01:22:37] hnanon: The first user of each company that registers.
[01:22:41] drale2k: you can use "before_save" and then somehting like "self.role ||= 'default_role'
[01:22:58] hnanon: I've seen that before...
[01:23:06] hnanon: but I read before_create is better.
[01:23:13] hnanon: Any reason why?
[01:23:43] s2013: depends. before save works here
[01:24:02] hnanon: And it would be fine when editing also?
[01:24:33] s2013: when editing you need before_save i believe
[01:24:34] hnanon: It wouldn't overwrite the existing role when updating?
[01:24:46] s2013: so you need before_create
[01:24:51] drale2k: hnanon: as long as you don't set one
[01:25:10] drale2k: i guess you will have a select box for roles
[01:25:13] drale2k: or checkboxes
[01:25:20] drale2k: so you don't have to take care about spaces etc
[01:25:23] hnanon: Yeah select, when editing
[01:25:50] s2013: k well im gonna try to get some food. see you guys later
[01:25:52] hnanon: so whicj one?
[01:25:56] hnanon: create or save?
[01:26:29] hnanon: Am I putting that in the model?
[01:26:29] drale2k: as s2013 said, your only option might be before_save
[01:26:43] drale2k: yes, like here http://stackoverflow.com/questions/1550688/how-do-i-create-a-default-value-for-attributes-in-rails-activerecords-model
[01:29:42] hnanon: cool, thanks.
[01:44:54] andrewanderson: what's the best method for reloading a page via ajax? is replacing html the best option?
[01:50:48] axilaris: got a general question, whats a popular (beautiful as well) charting framework that rails people like to use ?
[01:50:53] axilaris: there are quite a few here https://www.ruby-toolbox.com/categories/graphing
[01:51:07] Seich: andrewanderson: it depends on what you are trying to do.
[01:51:34] axilaris: whats a good pick ?
[01:51:40] andrewanderson: Seich: i've got a tag cloud on the right, and when one is clicked, i want the content to refresh
[01:52:25] andrewanderson: axilaris: chartkick looks pretty to me
[01:52:32] andrewanderson: plus it's just one line of ruby, can't go wrong with that
[01:52:39] axilaris: yup...atleast thats top in the list
[01:52:54] axilaris: thanks andrewanderson for a pick :)
[01:53:09] andrewanderson: plus it's all javascript so hah :D
[01:53:26] axilaris: just curious, ruby toolbox, does it tell the most popular ones ?
[01:53:27] hnanon: I need to set a defualt attribute on a user only when the first user is created.
[01:53:28] andrewanderson: https://github.com/topfunky/gruff this one looks good too.. google one blows
[01:53:50] hnanon: the user fields are in nested attributes in a new company form.
[01:54:01] axilaris: i like google chart, but it looks a bit horrible from the ruby website
[01:54:02] andrewanderson: hackeron: if User.count == 0, @user.attribute = set?
[01:54:09] hnanon: I want the first user for that company to be have a role = admin
[01:54:38] andrewanderson: if Company.users.size == 0?
[01:54:54] axilaris: thanks andrewanderson, i'll shortlist between these 2 u recommend
[01:56:31] Seich: andrewanderson: replacing the content is the way I'd do it.
[01:57:15] andrewanderson: $('.content').replace_html("<%J render content %>')?
[01:57:23] andrewanderson: doesn't look very pretty
[01:59:30] axilaris: andrewanderson: probably go with chartkick, got this nice geo chart
[01:59:53] andrewanderson: plus it's javascript!!
[02:00:10] axilaris: thought all are js/jq
[02:00:34] andrewanderson: i bet a couple actually draws theirs
[02:00:40] sevenseacat: ive used highcharts with much success before, not in a rails app though
[02:00:58] jrock20041: I may be crazy to ask this, but is there a gem that will allow me to easily build reports of my data from the db?
[02:01:22] Seich: I personally love amcharts. If you're looking for something fully in js, that'd be my first recomendation.
[02:01:23] axilaris: ryan bates has a tutorial on highcharts... but chartkicks looks nice
[02:01:33] andrewanderson: ryan bates for president
[02:01:38] Seich: andrewanderson: I don't think you have a way around it :/
[02:02:27] axilaris: thanks Seich, amcharts looks really nice too
[02:06:07] axilaris: i'll probably choose now amcharts, visually very impressive, more powerful features to play with. Thanks Seich!
[02:06:39] sevenseacat: amcharts does look shiny
[02:07:22] sevenseacat: not cheap though
[02:08:42] axilaris: didnt see that. thats a skip, too bad
[02:09:24] Seich: axilaris: aw, what a shame. Completely forgot about that /: sorry.
[02:11:04] hnanon: How to I fire off an activerecord call back after a create action?
[02:11:51] Seich: hnanon: a filter, maybe? http://guides.rubyonrails.org/action_controller_overview.html#filters
[02:15:37] jrock20041: Looking to subscribe to http://railscasts.com/ . Is it worth it and will it be helpful for someone who is coming from a java background?
[02:16:51] sevenseacat: well its free at the moment because there's no new material coming out
[02:16:59] sevenseacat: hasnt been for nearly a year
[02:17:40] jrock20041: all of its free or some of the vids?
[02:18:15] sevenseacat: i'm not sure how it will work for new subscribers but existing subscribers arent getting charged atm
[02:18:44] sevenseacat: for access to all videos
[02:18:45] jrock20041: Yeah I just signed up and it says I need to subscribe
[02:18:48] axilaris: jrock20041: worthit especially now, i'ved paid once and as long as ryan bates doesnt come back yet its free
[02:19:38] axilaris: jrock20041: there is a link in the email that will keep you in subscription mode
[02:19:54] sevenseacat: a lot of the videos are free, only the pro/revised ones require a subscription
[02:19:56] jrock20041: well I just clicked the signin with github
[02:20:19] axilaris: thats different, u could link your subsciption to github
[02:21:28] johncjensen: Hey, anyone here with experience getting ckeditor + carrierwave s3 uploads working on heroku?
[02:21:42] johncjensen: It's working locally but when deployed in production the "upload" tab is nowhere to be seen when opening the image button on the toolbar.
[02:23:17] jrock20041: so I guess I should sign up for a month and see if that changes
[02:23:46] sevenseacat: likely you'll get chanrged for one month and then no more
[02:24:08] sevenseacat: i havent been charged since june last year
[02:25:10] axilaris: where is that dude ? burnt out ? wonder if he comes back he'll remember rails
[02:25:22] sevenseacat: yeah he got burnt out and took some time off
[02:26:01] axilaris: when i went for my month vacation, everything got erased :)
[02:26:15] jrock20041: Wish he accepted paypal instead of direct cc
[02:27:20] sevenseacat: usually people say the opposite
[02:28:04] jrock20041: :) I just feel its a little more secure than giving a random site my cc
[02:29:44] sevenseacat: i'm more paranoid than most when it comes to that kind of thing, and i think railscasts is okay :)
[02:30:56] kies: sevenseacat, yup i signed up back in feb and that was the only time i was charged
[02:32:06] gen0cide_: If I have a string column in a DB, how would I write a scope where that string value is measured against a function?
[02:32:37] gen0cide_: scope :good -> { |obj| Library::Module.is_good?(obj) }
[02:32:50] gen0cide_: does that work?
[02:36:10] Oog: for db migrations i know it is usually like add_column_to_model right but what if im adding a feature like dropbox support
[02:36:30] sevenseacat: migrations can be named whatever you want
[02:36:33] Oog: and just call my migration add_dropbox and put multiple add_columns for different tables in one migration
[02:36:41] Oog: is that bad style
[02:36:49] sevenseacat: as long as the names arent duplicated
[02:37:05] Oog: ok thanks
[02:38:02] hnanon: I need to set role = "admin" for the first user when a company registers.
[02:38:34] hnanon: I tried an after filter, but I can't seem to get it to work.
[02:39:12] hnanon: Should I use an activerecord callback in the model?
[02:42:05] gen0cide_: sevenseacat: the simple answer is no it doesn't
[02:42:15] sevenseacat: gen0cide_: i know.
[02:42:25] gen0cide_: how do I reference an object inside a scope?
[02:42:56] sevenseacat: what you're trying to do generally isnt done - scopes translate to sql queries
[02:43:10] gen0cide_: scope :updated, -> { |obj| Foobar.is_updated?(obj) }
[02:43:35] gen0cide_: any pointers on how to accomplish it?
[02:44:53] sevenseacat: what is Foobar.is_updated?
[02:45:17] gen0cide_: its a method that checks multiple columns of Foobar against a third party library
[02:45:57] sevenseacat: think of how that would be if it ran like that - it would have to instantiate every object in the database to run it against that method
[02:46:30] gen0cide_: unfortunately thats what I'm going to have to do because the field in the DB isn't compared w/ an DB operator
[02:46:38] ritek: would it be possible to use sass in Rails 1.1.6?
[02:46:48] sevenseacat: ritek: unlikely.
[02:47:00] sevenseacat: i strongly recommend not using rails 1.1.6.
[02:49:37] Scient: wait what
[02:49:39] Scient: 1.1.6? :D
[02:50:35] jeremy_w_rowe: ritek: checkout `sass --watch`. You aren't going to get any asset pipeline goodness with that old of a version of rails, but you can have sass compile scss/sass files into css
[02:53:01] jrock20041: Well I ended up paying for railscast. So lets see how much this helps
[02:53:10] Etriaph: G'day folks.
[02:53:36] hfp: Hey guys! Do you test for SSL in your specs or do you assume that if you set it in config/environments/production.rb with `config.force_ssl = true` then it will always be there?
[02:55:18] Scient: assume its there
[02:55:31] Scient: its technically library code which is already tested
[02:55:43] ritek: jeremy_w_rowe: thaks
[02:55:53] jeremy_w_rowe: ritek: no problem
[02:56:37] ritek: http://rubyonrails.org/download/ shows Ruby 2.1.0 as the recommended version to use with Rails 4.1.0, but what about Ruby 2.1.1?
[02:57:05] Etriaph: Ruby 2.1.1 is a patch of Ruby 2.1
[02:57:08] Scient: its a minor update, so use it
[02:57:52] Etriaph: Version numbers are MAJOR.MINOR.MICRO, you should be concerned with MAJOR.MINOR, a higher MICRO value means a better patch level of the other two echelons
[02:58:58] Etriaph: Can anyone suggest a gem (or methodology) for generating dummy data during development? I want to generate about 6 months of data, 2 - 3 records per day
[02:59:01] ritek: makes sense. thx
[02:59:17] sevenseacat: well no, patch level is something different
[02:59:32] ritek: patch is like 2.1.1-pxxx
[02:59:44] sevenseacat: unless ruby has ditched that now that they're using semver
[02:59:50] Etriaph: sevenseacat: Yes, maybe not the best nomenclature :)
[03:00:17] Etriaph: But in *nix software, typically the MICRO version describes the patch level of the MAJOR.MINOR software version
[03:00:32] Etriaph: I realize Ruby does it a little differently
[03:01:25] sevenseacat: they're a bit special.
[03:03:25] Etriaph: I read on SO that I should try FactoryGirl for creating fake data, but it seems much more aligned with creating tests than anything
[03:03:35] Etriaph: Has anyone used FactoryGirl for something like this?
[03:04:03] sevenseacat: you can use it outside tests - all it does is give you an easy way of generating data
[03:04:12] sevenseacat: semi-realistic data
[03:04:25] Etriaph: Well I'm more concerned about volume at the moment.
[03:04:50] Etriaph: I want to create fake data as if 2 - 3 records were created a day using created_at to store the time
[03:05:35] Etriaph: I could write it into a dummy action and execute it, just wondering if there was a gem that could speed this up if I had to do it in the future
[03:06:05] sevenseacat: factorygirl can do it sure, just specify the created_at
[03:06:16] sevenseacat: eg. `FactoryGirl.create :user, created_at: 3.days.ago` which is what i just did to test that it works
[03:06:41] sevenseacat: and it created a record with created_at: "2014-04-20 03:05:36"
[03:07:42] Etriaph: OK, does FactoryGirl have a way to say "Create records like this over six months?" or would I have to write a loop?
[03:08:02] sevenseacat: all factorygirl does is generate records based on rules you specify
[03:08:11] Etriaph: Ah, fair enough.
[03:08:13] sevenseacat: you define the factory with the data it should use for fields
[03:10:00] sevenseacat: https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md is a good read for factory girl's functionality
[03:10:40] x1337807x: Anybody ever had an undefined method/variable `vars` error trying to create a Rails 2.3.18 app? -> https://gist.github.com/1337807/6412d4f650c57c871039
[03:11:01] sevenseacat: better question is, why are you trying to create a new rails 2.3 app
[03:11:16] x1337807x: Benchmarking
[03:11:28] x1337807x: This is the code that raises the error:
[03:11:29] x1337807x: https://gist.github.com/1337807/5e755f0297e94d6198ff
[03:11:38] x1337807x: vars is undefined inside the eval
[03:12:02] x1337807x: I'm using Ruby 2.1 and it appears that the binding isn't passing correctly into the eval
[03:12:30] x1337807x: The binding outside has a different object_id than the one inside. Maybe this is to be expected but it's counterintuitive.
[03:13:42] x1337807x: ACTION The Rails 2.1 docs have an example of eval being used in a very similar way.
[03:15:03] rhizome: i'd be surprised if 2.3 ran cleanly under ruby 2.1
[03:16:30] s2013: are there any famous rails 1 app?
[03:18:42] sevenseacat: rhizome: so would i
[03:21:32] s2013: so we need to update one of our app from 3 to 4.. how would i go about doing it? create a new branch or fork it to a new repo?
[03:22:10] rhizome: branch is fine. you're just changing gemfile and fixing whatever comes up.
[03:22:43] s2013: what about if i need to add new features alongside
[03:25:05] sevenseacat: branch it, fix it, merge it
[03:29:33] rhizome: one thing at a time
[03:31:56] omosoj: Hey guys, lil help: https://gist.github.com/josomo/11201966
[03:33:32] sevenseacat: omosoj: the link is outside the products block
[03:33:37] sevenseacat: therefore product is not defined
[03:35:05] omosoj: sevenseacat, ok, thank you.
[03:37:57] Etriaph: G'day bratsche
[03:38:41] bratsche: How's it going?
[03:44:17] brendan6: I had a general question about code style that I've been struggling with a bit that I was wondering if someone could give some insight towards. Question of what arguments to include in an PORO constructor/methods. Outlined http://pastie.org/9102347
[03:45:34] sevenseacat: well it depends on the object and what makes sense for it
[03:46:08] sevenseacat: for a form object, params might make sense as a constructor argument, and i wouldnt pass a resource at all
[03:46:11] brendan6: Right. Given that example I feel like I would be most inclined to use Approach 3 because it seems familiar but other examples its hard to determine
[03:46:31] brendan6: Oh ok. So more so Approach 2
[03:46:37] sevenseacat: no, i wouldnt use any of them
[03:46:55] sevenseacat: a form object shouldnt have the responsibility of updating another object
[03:47:09] jrock20041: Is there any recommended sublime plugins to install for rails?
[03:47:52] sevenseacat: jrock20041: i just use syntax highlighters.
[03:47:59] brendan6: I've kind of felt that was the responsibility of a form object.. Take params to update an object with
[03:48:48] brendan6: jrock20041: Also, I would recommend trying RubyMine
[03:48:59] sevenseacat: rubymine isnt a sublime plugin
[03:49:31] brendan6: No, its not. But I would recommend trying it.
[03:50:39] bratsche: Good thing there are plenty of options so everyone is happy.
[03:51:02] bratsche: How's it going sevenseacat?
[03:51:10] jrock20041: Was looking at that but not sure I want to spend cash on that for what I will be doing
[03:51:55] bratsche: fwiw vim is very nice too, but there's a small learning curve to it.
[03:52:00] sevenseacat: bratsche: i'm alive. i think thats a good start.
[03:52:10] bratsche: sevenseacat: Cool enough. :)
[03:52:49] brendan6: The FormObject example is just an example though. I'm more so concerned about trying to isolate the thought process in deciding what to include in a constructor vs. method
[03:53:12] sevenseacat: it depends on the object's responsibilities.
[03:53:54] sevenseacat: if an object shouldnt exist without some data, then that data should get passed in at initialize time
[03:56:51] brendan6: Ok so given I have an object whose role it is to sync data from an external source to a set of relations in a domain object. The object shouldn't exist without the external source or without the domain object it is syncing to?
[03:57:44] bratsche: ACTION tries parsing that again.
[04:00:32] sevenseacat: real short answer: i dont know.
[04:01:19] sevenseacat: or maybe 'it depends'
[04:03:37] Meatchicken: Not strictly related to Rails but -- Under most NDAs there is a 'Per' -> Wtf do people put there?
[04:06:24] brendan6: sevenseacat: I think I might just be overthinking it. The object is small enough in its current state that its more of a just pick one approach and go with it. If it evolved to a point that makes sense to move something things around then so be it. I guess that is the point of refactoring
[04:07:28] rhizome: sounds academic
[04:08:07] brendan6: Per can sometimes refer to an "Agent" as in an acting authority to make a deal for someone else
[04:11:10] Meatchicken: brendan6, Thank you
[04:27:26] s2013: so dhh is against service objects? im confused
[04:28:20] sevenseacat: dhh is against nearly everything
[04:29:01] s2013: interesting
[04:29:15] s2013: is he against unit testing or something?
[04:29:22] sevenseacat: no, he likes test unit
[04:29:30] Meatchicken: lol; protect the rails way!!
[04:29:37] s2013: cause rspec is better than wha the uses?
[04:29:53] s2013: does he have an ego issue or somethinG? and wow he curses a lot
[04:29:53] Meatchicken: stick to omakase gaiz
[04:30:05] sevenseacat: he's got an ego the size of canada.
[04:30:09] sevenseacat: from what ive seen.
[04:30:37] s2013: cause im at the stage where i go from writing run of the mill rails app to writing scalable, maintainable apps and i see lots of patterns and architecture but a lot of conflicting information
[04:31:59] Criten: You guys stay up late.
[04:32:07] sevenseacat: Criten: it's lunchtime.
[04:32:08] s2013: i stay up til 2 am usually working
[04:32:11] s2013: sometimes even later
[04:32:27] Criten: Sounds like what i'm doing.
[04:32:28] s2013: i basically have 2 full time jobs. this week its tough cause daytime im at railsconf and then im finishing up my actual work
[04:32:46] Criten: networksolutions was down ALL DAY
[04:32:51] Criten: and we where susposed to launch today
[04:32:59] Criten: and we had to change some dns settings
[04:33:07] Criten: (frustrating)
[04:33:40] s2013: my mail still keeps getting flagged as spam by gmail . wtf
[04:33:42] dopie: Criten, lanch what?
[04:34:04] Criten: This portal
[04:34:26] dopie: Criten, wha tportal?
[04:34:40] s2013: to catch pokemons
[04:34:52] Criten: http://hp-cloud-agile.herokuapp.com/
[04:35:06] joy4u: I am creating a Polymorphic association with Devise Gem in Rails 4 but when saving the form the data of the User is not saving. In console it is showing "Unpermitted parameters: user". The main idea is that there are two types of users organiser and vendor each has different fields in registration form so i want each to have respective registration form but a single signin form.....code is pasted here https://gist.github.com/himadriganguly/1111218
[04:35:24] s2013: joy4u, mass assignment issue
[04:35:30] s2013: did you permit it?
[04:35:37] s2013: you work for hp Criten ?
[04:35:43] joy4u: s2013: yeah i permit it....
[04:35:50] s2013: paste your code
[04:35:58] Criten: s2013: we are an approved vendor... so.. kinda
[04:36:08] joy4u: s2013: pasted the code check out the link
[04:36:13] s2013: didnt see it, sorry
[04:36:25] s2013: actually the link doesnt work either
[04:37:21] joy4u: s2013: https://gist.github.com/himadriganguly/11112184
[04:37:49] joy4u: s2013: it is opening here
[04:38:27] s2013: k it works now
[04:38:28] Criten: working for me too
[04:38:35] joy4u: s2013: ok
[04:38:49] s2013: maybe im just super tired
[04:38:56] sevenseacat: no, the link is different now :)
[04:39:16] s2013: oh the 84 was cut off
[04:39:54] Criten: Welp.. I think I transfered over all the records (changing nameservers) now i just need to wake up and hope everything works
[04:41:19] joy4u: s2013: is the link working?
[04:41:51] s2013: Criten, good luck
[04:43:15] Criten: then i have the joy of sending out the blast emails to all the old site's users telling them to reset their passowrds
[04:43:21] Criten: then going on vacation for the rest of the week
[04:43:35] Criten: and hoping everything works out
[04:44:02] Criten: (great timing i know)
[04:44:07] joy4u: s2013: have you found any error in the code?
[04:44:25] s2013: joy4u, tbh im super tired andnothing is making much sense
[04:44:33] s2013: but im sure sevenseacat can help you
[04:44:40] Criten: The client we are dealing with is such a headach. She kept wanting to change things, we where susposed to launch a few weeks ago..
[04:44:47] sevenseacat: how about.... no to that one
[04:45:23] joy4u: sevenseacat: can you have any idea about the problem?
[04:45:41] s2013: Criten, story of my life. which is why i gave up consulting
[04:45:57] joy4u: sevenseacat: do you have any idea about the problem?
[04:46:58] Criten: s2013: oh.. i've recieved 2 emails from what I believe are people you blased my job offering to, both are companies looking for work
[04:47:27] dopie: hey how would i do this... I have a user who needs to complete 5 steps he cannot proceed to other steps until he finished the one before...
[04:49:21] joy4u: i have also posted the problem on Devise google group, Jose Valim posted there that i need to pass :user tp the list of permitted attributes but i have done that but the problem remains the same, am i doing anything wrong? https://groups.google.com/forum/#!topic/plataformatec-devise/tP0NDe-LPX0
[04:49:36] s2013: what do you mean
[04:49:42] s2013: were they individuals or like dev shops?
[04:49:47] Criten: Like dev shops lol
[04:49:59] s2013: o. fuckers. i usually tell them not to do that
[04:50:06] s2013: but ill make it more explicit next time
[04:50:21] s2013: yeah i got emails from people asking if i was crazy or not.hah
[04:50:27] s2013: cause no one wants to move there :(
[04:50:37] Criten: http://www.stackbuilders.com/
[04:50:46] s2013: what about them
[04:50:55] Criten: They are the guys who emailed me
[04:50:55] s2013: they emailed?
[04:51:08] s2013: they are pretty big. didnt realize the ywould need to email someone
[04:51:19] Criten: "Adam Christopher Troeder"
[04:51:35] s2013: ok pm me those stuff please though. not on public
[04:51:40] Varun_krishna: Hi all I am following this http://guides.rubyonrails.org/getting_started.html to get started with ROR but when I run the rails server I get the following error http://pastie.org/9102438
[04:51:44] joy4u: Will the permitted attributed be
[04:51:44] joy4u: ??u.permit(:first_name, :last_name, :email, :password, :password_confirmation, :username, :user)
[04:51:44] joy4u: or??u.permit(:user[:first_name, :last_name, :email, :password, :password_confirmation, :username])
[04:51:57] electroglue: hello I need to add piwik to a rails app
[04:52:02] electroglue: I have installed the gem but where do I put this ? <%= piwik_tracking_tag %>
[04:52:06] electroglue: http://pastebin.com/ps7wNpLV
[04:52:08] electroglue: that is the code
[04:52:34] sevenseacat: oh goody, more people that cant read error messages
[04:53:04] joy4u: electroglue: try to use http://gist.github.com for pasting code
[04:53:45] joy4u: sevenseacat: do you have any idea about the polymorphic problem
[04:53:45] electroglue: https://gist.github.com/anonymous/11203099
[04:53:52] sevenseacat: joy4u: stop asking me.
[04:54:06] electroglue: Everywhere I put that <%= piwik_tracking_tag %>
[04:54:06] joy4u: sevenseacat: ok sorry
[04:54:08] tfitts: joy4u: seriously? you're still on this?
[04:54:14] electroglue: it fails and I get errors
[04:54:28] electroglue: ACTION ruby newby :)
[04:54:33] joy4u: tfitts: yeah really :)
[04:54:34] sevenseacat: do we get to guess what the errors are?
[04:55:18] Criten: electroglue: you only posted the view..
[04:55:40] sevenseacat: the view also doesnt have the piwik thing anywhere in it
[04:55:56] electroglue: Well what I'm saying is that I need to add it there
[04:56:09] electroglue: it keeps telling me that its not allowed in certain places
[04:56:20] joy4u: tfitts: you can checkout the google group https://groups.google.com/forum/#!topic/plataformatec-devise/tP0NDe-LPX0
[04:56:37] sevenseacat: where does the piwik documentation tell you to add it?
[04:57:06] electroglue: it's a piwik gem and it really doesn't it just says add it to the application
[04:58:35] electroglue: trying to find it now
[04:58:55] electroglue: https://github.com/piwik/piwik-ruby-tracking
[04:58:59] Etriaph: It goes in the layout
[04:59:02] Etriaph: The documentation says so
[04:59:15] Etriaph: app/views/layouts/application.html.erb
[04:59:31] Etriaph: Read http://rubydoc.info/gems/piwik_analytics/1.0.2/frames
[04:59:55] sevenseacat: oh no, the github repo is named differently
[04:59:58] Etriaph: No, that's the gem the piwik main site says to use
[05:00:15] tfitts: I do have a general question about a polymorphic association. Right now I have an OrderEvent model which is only used to track when an order is viewed outside of our normal queue/pick/ship processes. I'm about to add an issues model that will have polymorphic association with items, orders, and order_items that will be used to record issues with any of those models. Does it seem like
[05:00:16] tfitts: it would make sense to use the issues model in place of the order events as well and just add a issue_type field and mark it as accessed?
[05:00:24] sevenseacat: so the question still returrns to, whats the actual error with this piwik thing?
[05:00:41] Etriaph: sevenseacat: user error maybe?
[05:00:42] electroglue: Etriaph: and sevenseacat that is what I showed you on the link
[05:00:44] sevenseacat: 'not allowed in certain places' isnt something we can fix
[05:01:56] electroglue: sevenseacat: well that might be true, but the error basically is summed up in what I said
[05:02:22] electroglue: I'll run it again... Etriaph is that not the view that I showed you?
[05:02:39] sevenseacat: if you cant show us an actual error, we cant help you, sorry.
[05:02:42] electroglue: Illegal nesting: nesting within plain text is illegal.
[05:02:54] sevenseacat: so what does your code look like when you get that error
[05:03:02] sevenseacat: you have an indentation issue
[05:03:21] Varun_krishna: So guys how do I change the default port number (3000) ?
[05:03:25] electroglue: https://gist.github.com/anonymous/11203241
[05:03:27] s2013: rails s -p 4000 Varun_krishna
[05:03:33] s2013: sub 4000 to whatever new port
[05:03:45] electroglue: hey I knew that answer hehehe
[05:03:50] s2013: hehe electroglue
[05:03:53] sevenseacat: electroglue: haml is whitespace-sensitive - you cant just put it in the middle of a line like that
[05:04:04] sevenseacat: keep the indentation the same
[05:04:10] electroglue: Ok let me try that
[05:04:13] s2013: why are you using <% in haml
[05:04:19] sevenseacat: and dont put it inside the javascript block, and remove the erb <% %> tags
[05:04:58] electroglue: well I tried it without the % but I had the indentation wrong so it failed anyway...then I got lost :o(
[05:05:22] EasyCo: Hey guys, I'm just trying to change the scale of my decimal field in a migration and I'm getting errors
[05:05:23] sevenseacat: this is why we generally dont recommend haml to newbies
[05:05:43] s2013: electroglue, learn basics of erb first before moving to haml
[05:06:27] EasyCo: change_table :line_items { |t| t.change :cost, :decimal, :scale: 2 }
[05:06:33] EasyCo: Does that not look correct?
[05:06:38] Etriaph: And yup, I hate CSS.
[05:06:42] EasyCo: Rails 4.1
[05:06:56] Etriaph: sevenseacat: nth-child(even) doesn't work for me
[05:07:09] sevenseacat: define 'doesnt work'
[05:07:11] Etriaph: Reported to be the CSS3 way, but ya
[05:07:16] sevenseacat: preferably with a fiddle
[05:07:45] Etriaph: Trying to stipple table rows.
[05:08:32] Etriaph: http://jsfiddle.net/yS74m/
[05:09:06] sevenseacat: that css is completely invalid - you cant nest selectors like that
[05:09:09] Etriaph: Tried it with background-color too, as most examples used that, and they don't stipple
[05:09:17] Etriaph: Oh, SCSS, one sec..
[05:10:11] joy4u: what is the meaning of Unpermitted parameters: user in polymorphic association?
[05:11:02] Etriaph: http://jsfiddle.net/yS74m/1/
[05:11:08] electroglue: sevenseacat: Etriaph and s2013 thanks for the help
[05:11:17] Etriaph: Did you get it working?
[05:11:29] electroglue: yes I did Etriaph thanks to you guys
[05:11:29] sevenseacat: Etriaph: now look at the generated css - 'table thead tr:nth-child(even)'
[05:11:50] Etriaph: Oh goddamn
[05:11:52] sevenseacat: (hint: your thead only has one tr)
[05:11:59] Etriaph: Either not enough coffee or too much
[05:12:03] Etriaph: Thanks man
[05:12:18] sevenseacat: remove the th and they stripe perfectly
[05:12:33] sevenseacat: and now its lunchtime
[05:19:42] joy4u: how to set configure_permitted_parameters in devise for polymorphic association
[05:27:10] s2013: joy4u http://stackoverflow.com/questions/22315561/rails-4-0-devise-polymorphic-redirect-to-user-after-signup see if thi shelps
[05:28:10] dopie: hey guys how do i tell devise when a user registers to render another page?
[05:31:45] mkp: hey, anyone here have experience using sidekiq and sidekiq-status?
[05:32:36] s2013: after_sign_in_path_for i think dopie
[05:57:20] dopie: does devise create 2 models?
[05:57:22] dopie: or only 1 model?
[05:57:29] dopie: model.rb and user.rb ?
[05:57:32] sevenseacat: devise doesnt create any models by itself
[05:57:32] rvanlieshout: devise doesn't create any models
[05:57:56] dopie: class DeviseCreateUsers < ActiveRecord::Migration
[05:58:02] dopie: create_table(:users) do |t|
[05:58:11] sevenseacat: thats because you told devise to generate a user model
[05:58:35] sevenseacat: so guess how many models got generated
[06:04:50] dopie: going to php and coming back to rails
[06:04:52] dopie: is a headache
[06:04:59] dopie: rails is so much better
[06:06:29] sevenseacat: though you cant really compare a framework and a language
[06:06:53] karamazov: dopie: Had a similar experience. Had to jump in on a Laravel experience and became thankful for Rails conventions
[06:07:07] karamazov: *Laravel project
[06:07:21] sevenseacat: i hear good things about laravel
[06:07:24] dopie: karamazov, i had to jump in and do SEO
[06:07:32] dopie: for 30 wordpress sites
[06:07:46] dopie: 4 week project
[06:08:10] zorak8: whats a background worker??
[06:10:27] dopie: https://gist.github.com/staycreativedesign/11204311
[06:10:33] dopie: NoMethodError in Welcome#index
[06:10:38] dopie: im getting no method error
[06:10:56] sevenseacat: aaaand that no method error is?
[06:11:07] dopie: just updated it
[06:11:19] dopie: undefined method `approved?' for #<#<Class:0x007f5c9850c070>:0x007f5c98508fb0>
[06:11:20] sevenseacat: so where are you defining approved?
[06:11:31] dopie: WelcomeController
[06:11:55] sevenseacat: controller methods are not automatically accessible to views
[06:12:03] sevenseacat: and that method will never return false ftw
[06:12:33] sevenseacat: why not just call @user.approved? ?
[06:17:37] digitalknight: I am using twitter-bootstrap-rails with bootstrap-less-rails
[06:17:49] digitalknight: when I build, I ge the error:
[06:17:50] sevenseacat: this doesnt sound like its going to cause issues at all
[06:18:14] digitalknight: optional dependency 'request' required to import over http(s)
[06:18:43] digitalknight: i have been banging my head with this one but to no avail
[06:18:54] digitalknight: anyone seen this error before?
[06:19:14] rabbi1: Is there any way to output JSON in a pretty/formatted way in rails 4 ? while accessing .json ?
[06:19:35] sevenseacat: digitalknight: https://github.com/seyhunak/twitter-bootstrap-rails/issues/712
[06:19:52] digitalknight: sevenseacat: yup,and no replies there
[06:20:04] sevenseacat: i can see that.
[06:20:50] digitalknight: sevenseacat: so you can see that I have been struggling with this error for over a month :)
[06:20:52] mkp: has anyone used sidekiq-status to track sidekiq processes and communicate with the client? need help with a simple set up but their docs aren't very informative
[06:21:14] sevenseacat: digitalknight: well i didnt know that it was you that filed that issue
[06:21:25] digitalknight: sevenseacat: no issues :)
[06:21:49] i42n: Hey, can someone tell me why this routes setup replaces the default show route with updaete? https://gist.github.com/i42n/ae0df77e4e19385351e1
[06:22:08] sevenseacat: i42n: it doesn't
[06:22:29] digitalknight: sevenseacat: so any advice for me please?
[06:22:41] sevenseacat: digitalknight: don't make your life overly complicated :)
[06:22:43] i42n: sevenseacat: Actually it does not remode the show route but the podcast_path is mapped to podcast#update instead of podcast#show
[06:22:57] digitalknight: sevenseacat: with bootstrap?
[06:23:20] sevenseacat: with multiple bootstrap gems and with less
[06:23:25] sevenseacat: pick one, use it
[06:23:58] digitalknight: sevenseacat: so does this error mean that I have multiple bootstraps and less gems present in my app?
[06:24:03] sevenseacat: i42n: eh? not from that code
[06:24:17] sevenseacat: digitalknight: you just said you're using two bootstrap gems
[06:24:30] sevenseacat: "(14:17:35) digitalknight: I am using twitter-bootstrap-rails with bootstrap-less-rails"
[06:25:05] i42n: sevenseacat: yes it does. I can fix it with get 'update', on: :member, as: 'update' but I thought this should not be required normally...
[06:25:31] digitalknight: sevenseacat: yes,I have both,less-rails-bootstrap and twitter-bootstrap-rails present
[06:25:42] sevenseacat: digitalknight: why?
[06:25:53] digitalknight: but if I comment out the less, i get a nice error saying that cannot load file --less
[06:26:06] digitalknight: which is required by the autogenerated stylesheets I guess
[06:26:21] agent_white: offtopic -- What's with people hating on Rails? I go to a channel for beginner programming, only to get flak for my framework of choice. :(
[06:26:27] sevenseacat: well yes, twitter-bootstrap-rails is in less
[06:26:36] sevenseacat: so you need less
[06:26:40] sevenseacat: you dont need another bootstrap gem
[06:27:06] digitalknight: sevenseacat: so,reomove twitter-bootstrap-rails from the dependency?
[06:27:14] sevenseacat: digitalknight: pick *one* bootstrap gem.
[06:27:32] sevenseacat: i dont care which one. i wouldnt use either of those, because i dont like less.
[06:27:52] digitalknight: sevenseacat: so if I remove the twitter-bootstrap one and keep less-rails-bootstrap-rails,will that help?
[06:28:08] helpa: digitalknight: Why don't you try it and find out for yourself?
[06:28:08] sevenseacat: digitalknight: !try
[06:28:16] digitalknight: I am sorry I am being a noob,but this is really something I havent configured myself and have been handed over to maintain
[06:28:19] digitalknight: sevenseacat: thanks,let me do that
[06:29:06] sevenseacat: i42n: no idea why rails is doing that. you've probably confused it by trying to overwrite one of its default routes.
[06:29:10] dopie: hey sevenseacat got it working :)
[06:29:17] sevenseacat: dopie: great.
[06:29:17] dopie: <% if user_signed_in? && current_user.approved == true %>
[06:29:32] dopie: im making this ugly dropping veverything inside the views
[06:29:47] sevenseacat: yeah thats pretty stupid.
[06:29:57] Etriaph: dopie: I'd use CanCan or something like that.
[06:29:59] dopie: I guess i should scope it?
[06:29:59] sevenseacat: why not just current_user.approved? ?
[06:30:11] Etriaph: dopie: Really cleans up permissions logic
[06:30:15] digitalknight: if they asked me I have used JQuery
[06:30:18] digitalknight: silly bootstrap
[06:30:35] dopie: sevenseacat, because if he is signed in and not approved he gets a message
[06:30:54] sevenseacat: im not sure that even relates to my question
[06:31:06] dopie: it problably doesnt
[06:31:42] dopie: sevenseacat, i see what youre saying
[06:33:02] digitalknight: sevenseacat: i removed the twitter-bootstrap-rails gem dependency and only left the less-rails-bootstrap
[06:33:07] digitalknight: still get the same error
[06:33:29] sevenseacat: what exactly did you do?
[06:34:12] digitalknight: sevenseacat: just removed the gem 'twitter-bootstrap-rails' from Gemfile
[06:34:20] sevenseacat: now bundle and restart your server
[06:34:32] digitalknight: sevenseacat: did,got same
[06:34:56] sevenseacat: this is like pulling teeth
[06:35:12] digitalknight: more like pulling hair
[06:35:17] sevenseacat: gist the entire error, trace, etc.
[06:35:56] tagrudev: hmm still ror ? or dentist chan ?
[06:37:34] karamazov: sevenseacat: You're an irc mastermind.
[06:37:51] sevenseacat: karamazov: not just on irc. >:)
[06:38:29] karamazov: sevenseacat: ha I'm sure! Got a github account?
[06:38:48] sevenseacat: https://github.com/karpah
[06:40:08] sevenseacat: not much there, i keep to myself >_>
[06:40:21] karamazov: Sweet - Why are all the big Rails names in Australia?!
[06:41:13] digitalknight: sevenseacat: https://gist.github.com/atris/124b255773a596f42bfc
[06:41:20] digitalknight: karamazov: indeed!
[06:42:32] sevenseacat: digitalknight: you are doing something very odd there
[06:42:45] digitalknight: sevenseacat: yeah,I wonder the same thing
[06:43:14] sevenseacat: you appear to be using both ruby 1.8 and ruby 1.9
[06:43:40] sevenseacat: you've also chopped off the first part of the error message
[06:44:38] digitalknight: sevenseacat: umm,thats all that the error said actually
[06:46:21] sevenseacat: so why are you being warned about mass-assignment at thestart of the error then? :(
[06:46:48] digitalknight: sevenseacat: because my code was written for Rails 3.2 but then someone upgraded without telling me to 4.0
[06:46:58] digitalknight: and I did not really bother changing all my codebase
[06:53:25] agent_white: I need to adjust my sleep schedule to Australian once again so I can see/hear sevenseacat and Radar.
[06:53:45] digitalknight: sevenseacat: even google does not tell something logical for this error
[06:56:41] Radar: digitalknight: bro fix your Ruby install
[06:56:57] Radar: I have nfi how you installed it but it looks fucked
[06:57:59] digitalknight: Radar: unfortunately its all done in some weird automated way that my org has
[06:58:10] digitalknight: but what looks bad? I can try to fix it
[06:58:16] Radar: digitalknight: Then you're screwed further.
[06:58:25] Radar: digitalknight: As sevenseacat already pointed out, 1.8 is pointing to 1.9
[06:58:35] Radar: ./home/atris/PubFraudWorkBench2/env/BrazilRake-1.1/runtime/lib/ruby/site_ruby/1.8/amazon/brazil/ruby.rb:88:in `exec_build_script': Command failed (RuntimeError)
[06:58:40] Radar: "site_ruby/1.8"
[06:58:47] Radar: ./home/atris/PubFraudWorkBench2/env/Ruby19-1.0.Ruby19-1.0/runtime/ruby1.9/gems/1.9.1/
[06:58:50] Radar: "gems/1.9.1"
[06:59:00] digitalknight: this is so not good
[06:59:14] Radar: They do not match up with one another. Talk to whoever setup your Ruby or rm -rf it and install again using something sane like rbenv.
[06:59:37] digitalknight: Radar: thanks,will do something like that
[07:00:08] Varun_krishna: Hi guys I am getting this error ActiveRecord::ConnectionNotEstablished
[07:00:44] Etriaph: Varun_krishna: check config/database.yml to ensure that your connection parameters are correct.
[07:01:30] Varun_krishna: I am following this http://guides.rubyonrails.org/getting_started.html guide to getting started with RoR
[07:01:52] Varun_krishna: Etriaph: Ok I will paste it.
[07:02:14] Etriaph: Varun_krishna: Well if it has a password in it, sanitize it first :)
[07:02:55] Etriaph: But if you're following the guide you're likely using sqllite3
[07:03:14] Varun_krishna: Etriaph: this is what my database.yml looks like http://pastie.org/9102635
[07:03:39] Varun_krishna: Yes, I had installed it using the command yum install sqllite-devel
[07:03:44] Etriaph: That... doesn't look right.
[07:03:59] sevenseacat: definitely not right
[07:04:07] sevenseacat: pick one, jdbsmysql (lolwat) or sqlite
[07:04:19] sevenseacat: your config mixes both
[07:04:39] Etriaph: Your adapter should be sqlite3
[07:04:48] Etriaph: If that's what you intend to use.
[07:04:48] Varun_krishna: sevenseacat: But I haven't configured anything in database.yml.
[07:05:01] Etriaph: There's no way 'rails new' produced that
[07:05:36] Etriaph: At least not in my limited experience :)
[07:05:49] Varun_krishna: yes rails new blog produced that.
[07:06:33] sevenseacat: in no way shape or form will rails by default make you use jdbcmysql.
[07:06:58] Varun_krishna: sevenseacat: dunno .
[07:07:02] Etriaph: Nor mix it with configuration for sqlite3
[07:07:13] jammanbo: you know when you walk into a room and hear the weirdest part of a conversation...
[07:07:14] Etriaph: Change your adapter to sqlite3 and continue with the guide
[07:07:53] Etriaph: jammanbo: Like "...so I sat on her face so she could see how much cake I ate..."
[07:08:23] Etriaph: No word of a lie, my former boss to his *wife*
[07:08:30] Etriaph: The context was way out there though
[07:09:00] sevenseacat: Varun_krishna: here's all the sample database.yml files https://github.com/rails/rails/tree/v4.1.0/railties/lib/rails/generators/rails/app/templates/config/databases none are misconfigured like yours.
[07:09:10] Varun_krishna: Etriaph: Seriously I did not lie
[07:09:52] Etriaph: Varun_krishna: I know you believe that's what happened, I'm not accusing you of lying, I'm just in disbelief that rails new would ever spit out a database.yml that was that fubar'd
[07:11:08] jammanbo: I missed the start. Is it reproducible (on his machine)?
[07:11:20] Varun_krishna: Etriaph: Check this https://github.com/rails/docrails/blob/master/guides/code/getting_started/config/database.yml I have no idea on how the adapter changed.
[07:11:32] GriffinHeart: Hello, is there a way to debug where a rogue method comes from?
[07:12:01] Etriaph: Varun_krishna: I agree, it's strange. Once you fix the file you should be good to continue learning. :)
[07:12:20] Etriaph: jammanbo: Haven't asked yet
[07:12:29] jammanbo: GriffinHeart: Um, pry-debugger?
[07:12:37] Etriaph: Varun_krishna: Can you do a 'rails new foo' and see if it happens again?
[07:12:49] Varun_krishna: Etriaph: Thanks. Now should I delete the index.html in the public folder?
[07:13:07] Etriaph: Varun_krishna: Change the adapter and just continue with the instructions in the guide.
[07:13:13] GriffinHeart: can i set a breakpoint on a method name?
[07:13:17] Etriaph: Don't edit anything else unless the guide says so :)
[07:13:46] jammanbo: GriffinHeart: pry and pry-debugger
[07:18:58] dopie: quick question i created a devise user model and inside the migration i added a bnch of extra strings....
[07:19:09] sevenseacat: ACTION waits for question
[07:19:52] dopie: how do i show the specifc users information
[07:20:01] dopie: since there is not a show defined
[07:20:12] rabbi1: why can't I have a controller or model named 'format' ?
[07:20:42] sevenseacat: rabbi1: maybe its a reserved word.
[07:20:54] sevenseacat: dopie: same way you would show anything else?
[07:21:02] sevenseacat: create an action, render a view, render stuff in a view?
[07:21:28] rabbi1: sevenseacat: i could only see it in around 'to_json |format|'
[07:22:01] sevenseacat: rabbi1: what happens if you try to have one named format?
[07:22:01] dopie: sevenseacat, but users doesnt have a index or a #show
[07:22:10] sevenseacat: dopie: write one????
[07:22:10] GriffinHeart: jammanbo: i've debugged a bit and it seams the method is being called because it array_delegable?
[07:22:14] dopie: in the routes
[07:22:30] rabbi1: sevenseacat: some error, i actually removed it.. brb with the actual error
[07:22:35] dopie: devise_for :users, :controllers => { :registrations => "registrations" }
[07:22:40] dopie: that sthe routes
[07:22:46] dopie: so i would use the registrations controller?
[07:22:48] dopie: for the show
[07:23:24] sevenseacat: registrations controller is for modifying the current user
[07:24:29] scrapcode: So, after dabbling in rails for about 6 months and just getting to the point where I feel like I have a pretty good handle, I pull a "heroku run rake db:reset" on an app that I actually use daily and need [want] that info back... Is there a vaccine?
[07:24:42] scrapcode: vaccine... I meant cure, obviously.
[07:24:49] GriffinHeart: jammanbo: ok, lesson is don't name anything product because then if you do cart.cart_items.product and it "works" you scratch your head
[07:24:50] sevenseacat: scrapcode: whoops.
[07:25:14] scrapcode: sevenseacat, I take that as a negatory? haha
[07:25:29] sevenseacat: scrapcode: if you dont have a backup, gg.
[07:26:26] scrapcode: Didn't lose anything pertinent. It's just a little google bookmarks clone I coded a long time ago and just recently recoded from scratch for 4.x and using my own relations rather than "acts_as_taggable_on"
[07:26:43] scrapcode: lost some bookmarks that's all.
[07:27:03] rabbi1: sevenseacat: 'ActionController::UnknownFormat' on line 'respond_to |format|'. I guess may be changing 'format' will solve it ?
[07:27:24] sevenseacat: rabbi1: back up a bit
[07:27:32] sevenseacat: what are you doing to get that error
[07:27:34] scrapcode: I thought I'd use it as a learning experience though and ask, since I couldn't find anything via search. 'ppreciate the "gg," though!
[07:28:50] rabbi1: sevenseacat: nothing, my model name is 'format'
[07:29:07] sevenseacat: well if you didnt do anything, then you didnt get an error because youre not running any code
[07:30:09] rabbi1: sevenseacat: :) sorry. i meant i have a model named format, and if i try to add a record it show up the error mentioned under create action
[07:30:23] sevenseacat: hey there we go, you were actually doing something
[07:30:49] sevenseacat: right, because format is reserved in routes for the actual format of the request - so if you submit params for a new format object, you will get a naming collision
[07:31:33] rabbi1: sevenseacat: so is there a solution to retain the model name as 'format' or change the model name completely ?
[07:31:36] scrapcode: I got basically shunned in the C "community" for mentioning git... They really don't like git.
[07:31:41] sevenseacat: rabbi1: change it.
[07:32:21] rabbi1: also i got model name as 'type' let me check it. coz even that's reserved
[07:32:43] sevenseacat: thats most definitely reserved.
[07:33:17] K0nserv-: Does anyone have experience with setting up a tableless Model with support for associations? Is it even possible?
[07:36:53] Etriaph: Night folks.
[07:48:22] okthatsneat: @K0nserv we???ve recently used tableless models and associated them with each other using active resource. That???s only if you want a client to consume a REST api though
[07:50:18] K0nserv-: okthatsneat: Yes I am having a similar problem. Essentially I am using ActiveRecord with an non standard database and I need a many to many relationship between one real model and one that is tablesless
[07:52:01] K0nserv-: Looks like we are moving torwards making a table for the data though.
[07:53:46] K0nserv-: I am not using Active Resource though
[07:53:49] okthatsneat: I guess you could just store the references to the join table in an instance variable on the tableless model if you don???t need to persist it. If you do, add a table :)
[07:56:00] mlangenberg: Can I remove config.secret_token & config.secret_key_base when not using cookies at all?
[07:56:30] mlangenberg: For an API service, does not make much sense.
[07:57:08] emkey: Hi, I have newbie question. I can't figure out why I cannot interpolate link_to. https://gist.github.com/pyemkey/20251dc964365b405226
[07:57:48] sevenseacat: emkey: whats the problem?
[07:58:03] rvanlieshout: emkey: because your string isn't "html safe"
[07:58:35] sevenseacat: i was like 'theres nothing wrong with the interpolation there...'
[07:59:18] emkey: How can I fix it>
[08:00:05] rvanlieshout: use "#{}...." + link_to()
[08:00:09] rvanlieshout: or use two lines
[08:02:04] emkey: two lines helped, but your first suggestion return same result.
[08:16:41] sevenseacat: two lines would make more sense to me
[08:26:27] Zr40: I'm updating from 4.0 to 4.1. Now, in a form created with `form_for :foo`, `f.date_field :bar` causes a NoMethodError: undefined method `bar' for #<Foo:007fad806a8fa8>. No error is caused if I change `f.date_field` to `f.text_field`. This form isn't related to a model, but Foo does match the name of a model. How should I solve this?
[08:27:19] tobago: is it possible with Arel to append multiple join conditions onto an association?
[08:30:48] tobago: something like https://gist.github.com/trinibago/11207094
[08:31:27] tobago: that SQL works as expected, but I can't get the additional "and" condition on the third join getting to work.
[08:32:00] tobago: using :conditions will add the condition onto the where, which doesn't fit to my needs.
[08:33:55] tobago: the problem is I have to eager load the objects (PremedicationAttribute), and therefore can't use :joins for building my custom join.
[09:00:28] jiejing_zhang: Have a question about sidekiq and active record, I have a controller and a worker, the controller is compose some Post record, it have a attachment field(Paperclip, .image field), and in the task, it will do some post process of the attachment file, but in the controller I can find the .image field, but in the worker, I found the .image field was become empty...
[09:04:00] rushed: jiejing_zhang: you might find an example helpful http://railscasts.com/episodes/366-sidekiq
[09:06:12] tagrudev: https://github.com/blog/1823-results-of-the-github-investigation
[09:07:27] jiejing_zhang: Thanks, I ask this because the model's validate function return true in controller, but it return false in worker. I suspect there is some trick the connection between active record's db(postgres) and sidkiq worker.
[09:07:57] jiejing_zhang: I can ignore the valid? false, but just want to clear understanding it, incase there is some trick...
[09:22:30] mlangenberg: Anyone has experience with adding newrelic to a subclass of ActionController::Metal?
[09:23:06] mlangenberg: Funny enough the including the Rails3 module works for Rails4, but I including NewRelic::Agent::Instrumentation::Rails4::ActionController does not work in my Rails 4 app.
[09:24:39] mlangenberg: This base controller works with newrelic integration in Rails 4: https://gist.github.com/mlangenberg/5ade3ff5f546ad586427
[09:27:26] mlangenberg: but this does not seems to work: http://laika.io/2013/10/03/newrelic-ac-metal.html
[09:27:37] mlangenberg: I???m checking /newrelic on my machine
[09:36:36] ritek: is it really that good to let rails load all the css by using stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true ?
[09:37:10] ritek: I mean, instead of doing something like stylesheet_link_tag 'path/to/my/file.css' when required in each view
[09:37:53] sevenseacat: yes - it loads one single minified file and then lets your browser cache it, instead of a file for every page, likely multiple because you'll have common files
[09:39:32] K0nserv-: How can I specify the name of the connecting table for a many-to-many relation?
[09:41:35] K0nserv-: Nvm I found it
[09:42:52] _lazarevsky: I have an array of hases which looks like this -> [{:id => "1", :text => "text1"}, {:id => "2", :text => "text2"}, ...]
[09:44:33] _lazarevsky: I would like ot transform the array to look like this -> ["text1" => "1", "text2" => "2"]
[09:44:59] _lazarevsky: basically i would like to be able to get the id given the text
[09:45:15] _lazarevsky: so I can go id = transformed_array["someText"]
[09:45:21] _lazarevsky: Thank you so much in advance!
[09:46:04] workmad3: _lazarevsky: well, you can't transform it to an *array* like that... you need to transform it to a hash like {"text1" => "1", "text2" => "2"}
[09:46:18] _lazarevsky: that's exactly what I meant
[09:46:24] _lazarevsky: transform the array in a hash which looks like that
[09:46:41] workmad3: _lazarevsky: you can do that with .each_with_object
[09:46:51] _lazarevsky: I asked the same question yesterday and didn't get a complete answer
[09:46:59] _lazarevsky: fiddled around with the ones I did but couldn't get the syntax right
[09:47:05] _lazarevsky: a help would be greatly appreaciated
[09:47:15] workmad3: _lazarevsky: we tend to put people on the right track and then they should come back with specific issues
[09:47:19] _lazarevsky: as I am extremely new to Ruby.. I have been thrown in the deep and I learn as I go
[09:47:41] _lazarevsky: workmad3: yea I understand. I tried transforming it using .map
[09:47:47] _lazarevsky: but never could get the syntax right
[09:48:00] workmad3: _lazarevsky: ok... so now you put up what you did and what errors you were gettin
[09:48:34] workmad3: _lazarevsky: and it's worth noting that .map will only ever return an array... you'd need to take an extra step to turn it into a hash
[09:49:20] _lazarevsky: I tried using inject({})
[09:49:24] _lazarevsky: and then in the block I did merge
[09:49:31] helpa: _lazarevsky: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[09:49:31] workmad3: _lazarevsky: !code
[09:49:40] _lazarevsky: but that did not work if the hashes contained more than one key-value pair
[09:49:46] _lazarevsky: I dont have the code man.. this was last night
[09:50:06] workmad3: _lazarevsky: code for what you currently have, and what errors your getting
[09:50:22] workmad3: _lazarevsky: we aren't here to write your code for you, only to help you with your existing code :P
[09:50:30] _lazarevsky: I was fiddling around in the console
[09:50:36] _lazarevsky: set a breakpoint and experimented there
[09:50:38] workmad3: ACTION sighes
[09:50:44] _lazarevsky: that's what I mean by "I dont have the code man"
[09:50:57] workmad3: _lazarevsky: right... then get some code, play with it and come back here when you *do*
[09:51:23] workmad3: _lazarevsky: and I repeat... we aren't here as monkeys to write your code for you
[09:51:36] _lazarevsky: geez dont be so melodramatic
[09:52:01] _lazarevsky: I would've provided a solution and explained what it does if I were you
[09:52:08] _lazarevsky: at least that's what I do @ #emberjs
[09:52:27] _lazarevsky: anyway, I'll try write some code and will get back to you in a bit
[09:52:43] workmad3: _lazarevsky: I've done that many times before... almost without fail, the people I do that for come back almost immediately with the next problem they can't be bothered to think about
[09:53:23] _lazarevsky: [ { :foo => "bar" }, { :baz => "zeta" } ].inject({}) { |acc, hash| acc.merge! Hash[hash.to_a.reverse] } <- this works beautifully
[09:53:35] _lazarevsky: but see here I've only got one key-value pair in the hashes
[09:54:17] _lazarevsky: not too sure how to proceed
[09:55:01] workmad3: _lazarevsky: I'd start by noticing that in your example, you had keys in your hash on input that you didn't want in the output... so something that preserves all data isn't really the right thing to do
[09:55:15] workmad3: _lazarevsky: and I just mentioned .each_with_object, so maybe have a look up on the docs for that ;)
[10:03:06] ____aaaah: I'm not finding out what the problem is with validation helpers, this is the gist https://gist.github.com/git-toni/11209394
[10:03:41] ____aaaah: Even tho the record is invalid, it gets saved! And has an ID, hence line 36 doesn't pass :/
[10:04:46] rushed: ____aaaah: are you using save or save!
[10:04:58] workmad3: ____aaaah: the deposit doesn't save, but it stillexists in client.deposits
[10:05:08] ____aaaah: i'm not calling save myself
[10:05:26] ____aaaah: it doesn't??
[10:05:29] ____aaaah: but it is assigned an ID
[10:06:43] workmad3: ____aaaah: well, I assume the test on l33 passes from what you said
[10:06:52] workmad3: ____aaaah: could do with seeing the test run if there's other issues ;)
[10:07:17] ____aaaah: It definetely saves for some reason, I'm also 'reload'-ing the client, but it is still there
[10:07:28] workmad3: ____aaaah: but I can say with relative confidence that your test on L35 is based on a faulty assumption
[10:07:34] ____aaaah: l33 does indeed pass
[10:07:54] workmad3: ____aaaah: you're not reloading the client in the code you've provided
[10:07:56] ____aaaah: I'm not sure I understand what you mean by that :_D
[10:08:13] ____aaaah: oh, I missed that line in the gist, but I am indeed reloading it
[10:08:26] workmad3: ____aaaah: update the gist then
[10:08:28] helpa: ____aaaah: How to use Gist properly: https://github.com/radar/guides/blob/master/using-gist.markdown
[10:08:28] workmad3: ____aaaah: !gist-usage
[10:08:34] ____aaaah: actually I'm debugging at line 30-31
[10:08:51] ____aaaah: ok, doing that
[10:08:53] rabbi1: is there any gem to display .json output pretty in rails4 ?
[10:09:11] ____aaaah: pp not enough?
[10:09:11] workmad3: rabbi1: display it where?
[10:09:38] rabbi1: default show action workmad3
[10:09:47] rabbi1: or index action
[10:10:02] workmad3: rabbi1: ok... so you mean 'can a rails gem cause a browser to display my raw JSON output in a pretty manner?'
[10:10:15] rabbi1: workmad3: yeap ...
[10:10:27] workmad3: rabbi1: hopefully with that rephrasing you can start to get a hint to the answer ;)
[10:10:54] workmad3: rabbi1: and maybe start looking for a browser extension *hint* *hint* to display json in a nicer manner instead
[10:11:31] rabbi1: workmad3: o great, that's better :) thanks
[10:13:00] rabbi1: wondering why din't i think of extension ;)
[10:17:16] workmad3: ____aaaah: hmm... that's somewhat odd
[10:20:46] ____aaaah: workmad3: I'm editing the gist again, cause I believe I've got an idea of where the problem could be
[10:24:59] ____aaaah: workmad3: Here it is, I added a "before_validation" which I do have in my actual code but omitted in the gist, cause I though wasnt relevant https://gist.github.com/git-toni/11209394
[10:25:17] ____aaaah: I believe lines 15-16 make it assign an ID
[10:42:56] tagrudev: is it Friday yet ?
[11:04:49] ____aaaah: workmad3: Just for the record, https://gist.github.com/git-toni/11209394 lines 15-16 were indeed the issue, changed to l17,18
[11:06:20] ____aaaah: workmad3: however, doesn't it feel like an undesired behavior? Just because you call "update_attribute"(which on the other hand it's the very point because it skips validations) you can save to DB an invalid record
[11:08:57] mikecmpbll: lmfao at the LibreSSL webpage
[11:09:13] mikecmpbll: comic sans AND blinking text. love it.
[11:09:57] rushed: lol @ ???This page scientifically designed to annoy web hipsters. http://www.openbsdfoundation.org/donations.html to stop the Comic Sans and Blink Tags???
[11:10:31] mdw: hey guys, if I have an array of Document objects, that each have a title field, can I get the titles from it easily? In objective-C the easy way is [documents valueForKeyPath:@"title"], I can even go further for example, [documents valueForKeyPath:@"owner.name"] which would return an array of document owners names,
[11:11:18] rushed: mdw: your_array.map(&:title)
[11:11:29] mdw: rushed thanks!
[11:13:57] rushed: mdw: and if you want to be able to do that in objective-c check out rubymotion :)
[11:14:30] mdw: haha, yes I've noticed that :) pretty cool
[11:15:43] mdw: if I get better with Ruby, maybe I could have my whole stack on ruby. Ruby on iOS, Android, Web server :-)
[11:19:31] ____aaaah: is there a way to use rubymotion from a linux machine? Actually, in general, is there a way to develop ios from linux? (apart from phonegap)
[11:22:09] rushed: ____aaaah: lol
[11:31:38] Cork: is there a function in rails to localize datetime to time if it is today and date if it is anything else?
[11:32:57] mikecmpbll: Cork: pretty sure there isn't, no.
[11:33:48] ____aaaah: rushed: you never know
[11:46:16] congogr: Getting odd behaviour w/ ActiveRecord in Rails 3.2.13 in case anyone can help. I have an AR query to get the MAX value for a column, but after i order by a certain other column DESC and limit the results. However, when I use .maximum(:price) the .order is ignored. See below.
[11:46:23] congogr: ACTIVERECORD ------------ max_value = current_user.books.order('created_at DESC').limit(365).maximum(:price) RESULTING QUERY ---------------- (243.0ms) SELECT MAX(`books`.`price`) AS max_id FROM `books` WHERE `books`.`user_id` = 2 LIMIT 365
[11:50:14] congogr: anyone? :)
[12:06:36] momomomomo: Morning congogr
[12:07:09] momomomomo: Did you have a question?
[12:09:04] congogr: Yes, sorry momomomomo : Getting odd behaviour w/ ActiveRecord in Rails 3.2.13 in case anyone can help. I have an AR query to get the MAX value for a column, but after i order by a certain other column DESC and limit the results. However, when I use .maximum(:price) the .order is ignored.
[12:09:12] congogr: MY ACTIVERECORD ------------ max_value = current_user.books.order('created_at DESC').limit(365).maximum(:price) RESULTING QUERY ---------------- (243.0ms) SELECT MAX(`books`.`price`) AS max_id FROM `books` WHERE `books`.`user_id` = 2 LIMIT 365
[12:09:21] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[12:12:03] congogr: Also here momomomomo https://gist.github.com/geomic/11212865
[12:12:14] momomomomo: congogr: You're using #maximum from http://api.rubyonrails.org/classes/ActiveRecord/Calculations.html#method-i-maximum I believe
[12:15:00] congogr: momomomomo I see the ability to define ":conditions" in maximum but i see groupings etc - also I don't see why the limit is honoured in the format I use, but not the order
[12:15:00] momomomomo: congogr: you might need to do some reading up on SQL; sounds like you want to select the max of a field within a timeframe, not sort it
[12:15:27] momomomomo: also LIMIT just limits the number of results you receive
[12:15:40] congogr: momomomomo created_at is just an example. in my actual code, I am looking at another column, which actually varies in type
[12:15:47] helpa: congogr: Please do not use fake values, as they can be confusing or misleading. Sometimes both.
[12:15:48] momomomomo: congogr: !fake
[12:16:02] momomomomo: well congogr then you'll want ot select for ONLY that field, and then do your maximum
[12:16:07] momomomomo: still, you don't want sorting, at least not in sql
[12:16:55] congogr: so momomomomo what would be an acceptable way to do the same, by applying DESC order in created_at and limit the results to 365 before the maximum value is retrieved?
[12:17:44] momomomomo: what are you trying to do congogr? Are you trying to select the maximum value of some column, within a certain range of other constraints? IE: Select the max price from within this date range, or where the date is X/Y/Z?
[12:18:43] momomomomo: I gotta go in 2 min here
[12:18:58] momomomomo: sounds like you just need select.where('').max
[12:18:59] momomomomo: guides.rubyonrails.org/active_record_querying.html
[12:19:14] congogr: hm i will try that. :)
[12:19:23] momomomomo: you should read that article first
[12:19:35] congogr: i will (again) :-/ many thanks for your help
[12:23:09] rofel: how would you go about testing that profile urls match the name of the user they are for
[12:31:55] shashank_rs: I have user model which has rating as a attribute .. Using PSQL , when i do User.order('created_at DESC').limit(1).maximum(:rating) ... it returns the maximum value from the whole table rather than within the limit ..
[12:33:21] hypnosb: Is nokogiri capable of filling out forms or do I need mechanize?
[12:36:31] rushed: hypnosb: filling out as in scripting on a remote server sounds like mechanize???s primary use case
[12:37:33] shashank_rs: Guys plz help ..
[12:37:52] shashank_rs: some doubt in database query ..
[12:39:10] helpa: shashank_rs: How to ask good questions and get great answers: http://www.mikeash.com/getting_answers.html
[12:39:10] momomomomo: shashank_rs: !ask
[12:39:32] momomomomo: also shashank_rs you've been around here more than once, you should be getting the hang of this
[12:41:25] mikecmpbll: shashank_rs: you'll probably need a subquery
[12:41:28] mikecmpbll: and get the max of that.
[12:42:10] shashank_rs: momomomomo: helpa I have asked the question .. but no one answer .. so i again asked .. but if i post the question again then people say that u spam the irc .. :(
[12:42:28] mikecmpbll: User.where(id: User.order('created_at DESC').limit(10)).maximum(:rating)
[12:42:30] mikecmpbll: for example.
[12:42:33] mikecmpbll: (just a guess)
[12:42:55] momomomomo: shashank_rs: oh, I didn't see that; must have been disconnected.
[12:43:31] shashank_rs: momomomomo: helpa i repeatedly faced this type of things ... :(
[12:44:43] momomomomo: shashank_rs: well then better read that article on asking better questions
[12:45:23] mikecmpbll: and pay attention when someone tries to answer your question.
[12:47:13] shashank_rs: mikecmpbll: i was doing that only ...
[12:47:22] shashank_rs: mikecmpbll: i tried and it worked ..
[12:49:34] shashank_rs: mikecmpbll: momomomomo helpa may be because my english is not that good ..may be because of that i faced problem in asking the problem .. but this time i asked the question but helpa again pasted the link http://www.mikeash.com/getting_answers.html .. .. :)
[12:49:49] momomomomo: shashank_rs: helpa is a bot
[12:49:55] helpa: Hello. I am a HELPA 9000 computer. I became operational in #rubyonrails on the 28th of November 2009. My instructor was Ryan Bigg, and he taught me to sing a song. If you'd like to hear it, I can sing it for you.
[12:50:08] helpa: Daisy, Daisy, give me your answer do. I'm half crazy all for the love of you. It won't be a stylish marriage, I can't afford a carriage. But you'll look sweet upon the seat of a bicycle built for two.
[12:52:37] shashank_rs: momomomomo: mikecmpbll really ...!! oh my god ..:) :P
[12:52:50] timgauthier: helpa is so gangster, i didn't expect that song. I was thinking it would be like 50cent
[12:53:21] j0llyr0tten: how do i package a mobile version of a jpeg and display that when someone uses a portrait oriented mobile screen?
[12:53:56] mikecmpbll: j0llyr0tten: what happens when they turn their screen?
[12:56:23] workmad3: momomomomo: !auto btw
[12:57:00] workmad3: j0llyr0tten: !g css media queries
[12:57:05] momomomomo: workmad3: gracias
[12:57:37] workmad3: momomomomo: yw
[12:57:58] momomomomo: whyyyyy javaaaaa
[12:58:05] momomomomo: resolving dependencies that should be resolved :/
[12:58:18] workmad3: momomomomo: maven?
[12:58:26] momomomomo: yeah but I'm using intellij idea
[12:58:35] workmad3: momomomomo: maven has stupid dependency resolution
[12:58:53] momomomomo: it's working for lots of things, but some... not so much
[12:59:02] momomomomo: wonder if the version of Mahout i have is different
[12:59:22] workmad3: momomomomo: stupid in the sense that it'll happily pull down conflicting versions of the same goddamn library via transitive dependencies for two libraries, and then just bork out on tests or running the jar
[12:59:39] momomomomo: workmad3: that sounds awesomely fun to debug
[12:59:49] momomomomo: thank god I'm just downloading the lib and loading it in from a POM
[13:00:53] workmad3: momomomomo: and the 'solution' is to explicitly exclude said transitive dependencies... meaning that rather than having a nice neat declaration of dependencies, you instead have a horrific monster where you basically have to list every single frickin library ever touched in your build process if you want to have a stable build :(
[13:01:14] workmad3: momomomomo: not that I've been burned by maven in the past :)
[13:02:22] mikecmpbll: that came from a dark place.
[13:06:12] momomomomo: workmad3: I'd say the most frustrating thing about java so far is that so many libraries trample on each other; it makes following a book that just happens to use java tough to do when I've only got a little bit of java experience. I went through Core Java vol 1 last weekend, but knowing which Text library I want out of the 10 being offered is rough. Thankfully I'm able to guess 'hadoop' most of the time and come out OK since this lib relies heavi
[13:07:34] workmad3: I had 'fun' once stabilising the build of an app we had built in java... as part of the build process it was pulling in libraries that were included in the webapp container and so was causing conflicts
[13:08:00] workmad3: the 'diagnostic' message for this was a stack trace a couple of hundred lines long complaining about a null pointer exception in spring...
[13:08:45] workmad3: shit like that makes me appreciate rubygems just going 'fuck off, you've loaded rack v10 already, so stop trying to load rack v11'
[13:11:47] congogr: mikecmpbll I tried your suggestion .. User.where(id: User.order('created_at DESC').limit(10)).maximum(:rating) but no luck (I have a very similar problem to shashank_rs .. after reading more on ActiveRecord per momomomomo 's suggestion, still no luck
[13:11:58] mikecmpbll: congogr: you on mysql?
[13:12:19] momomomomo: because your'e just ordering
[13:12:20] mikecmpbll: you'll need to do a join instead then, sec
[13:12:31] mikecmpbll: mysql doesn't support limit in a IN subquery
[13:12:36] momomomomo: I suppose that shoudl do a subquery t
[13:12:41] momomomomo: ah :p there's your answer
[13:12:59] congogr: Both, please see what I shared with momomomomo earlier: https://gist.github.com/geomic/11212865#file-ar_max_ignores_order
[13:13:11] momomomomo: congogr: can't help now, mikecmpbll just answered your question
[13:13:37] congogr: Help on how I can actually structure a query that should check for the last X value based on a certain date column and get the maximum value (in this case price) from that order + limit, would be extremely appreciated mikecmpbll
[13:14:07] mikecmpbll: congogr: current_user.books.join("join (select id from books order created_at desc limit 365) as b on b.id = books.id").maximum(:price)
[13:14:09] congogr: How would a join apply in this case, when I'm working on one table only? I'm probably missing something
[13:14:33] mikecmpbll: yeah, you join the same table.
[13:14:45] mikecmpbll: oops, i missed out `by`
[13:14:49] mikecmpbll: congogr: current_user.books.join("join (select id from books order by created_at desc limit 365) as b on b.id = books.id").maximum(:price)
[13:15:31] congogr: I'll try this - and it looks as though it will work, but I find it a "hacky" solution for some reason? Joining the same table - for the sake of a MAX applied to an ordered DESC dataset? But then again, you suggest mikecmpbll that it's actually a MySQL limitation
[13:16:26] mikecmpbll: well, i'm pretty sure you need a subquery of some kind, because it seems the max applies before the limit in any case
[13:16:26] congogr: so AR is really not willing to help in this case - not to mention that writing this ties me to SQL-type DB's (production is PostgreSQL, dev is MySQL)
[13:16:48] workmad3: ACTION would probably have just done a current_user.books.order('created_at DESC').limit(365).pluck(:price).max
[13:16:59] mikecmpbll: workmad3: :D
[13:17:10] workmad3: congogr: you're using ActiveRecord... so you're tied to SQL-type DBs
[13:17:46] congogr: The other thing i was thinking of trying was to retreive all the results anyway (order + limit) and Then select the max value - but this would probably more computationally expensive
[13:17:53] congogr: actually, make that Definitely
[13:18:10] mikecmpbll: congogr: workmad3 just said that.
[13:19:14] workmad3: congogr: you'd need to benchmark... you're now dealing with joins and subselects, and in all honesty a .max on 365 items isn't exactly a back-breaker wherever you do it
[13:20:38] workmad3: congogr: going by your query log, your simple MAX query is already taking a quarter of a second...
[13:21:20] congogr: workmad3 , that's because i'm connected to a remote DB in California via SSH tunel.
[13:21:21] workmad3: congogr: btw... it would be a *really* good idea to use postgres in dev as well as production
[13:21:26] workmad3: congogr: heh :)
[13:21:48] workmad3: congogr: that would certainly add some latency :)
[13:22:05] mikecmpbll: you don't need the join either btw, just wanted to make it activerecord-y.
[13:22:57] axilaris: hi, i dont quite understand turbolinks in the asset pipeline much. i noticed each of my js.coffee gets loaded in every page
[13:23:01] axilaris: and its all caused by this
[13:23:02] axilaris: <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
[13:23:17] workmad3: axilaris: that's nothing to do with turbolinks
[13:23:27] congogr: odd, the suggested query, mikecmpbll, gives me NoMethodError - undefined method `maximum' for #<String:0x007fbc8ca6e258>: but I'm checking as it's probably a mistake on my side
[13:23:28] axilaris: how can i have each js.coffee files loaded for only the specific views ?
[13:23:38] workmad3: axilaris: that's the default behaviour of the asset pipeline, where the file 'application.js' pulls in all files in your javascripts directory
[13:23:39] axilaris: workmad3: ok, then im a bit lost
[13:24:03] mikecmpbll: congogr: have you missed the closing bracket before .maximum( ..) ?
[13:24:12] axilaris: workmad3: whats the best way to separate the load, do it in each views ?
[13:24:14] workmad3: axilaris: the idea is that it's more efficient to lean on the browser being able to download a single file and keep it compiled in memory once, rather than have multiple resources downloaded and compiled on each page transition
[13:24:33] workmad3: axilaris: in production, all those files would be compiled down into a single file
[13:24:33] congogr: mikecmpbll: no it's there
[13:24:36] cpruitt: axilaris: I think the idea is that by default it loads once on first page load & then everything is faster because the browser has cacehd it.
[13:24:44] mikecmpbll: congogr: gist your console workings
[13:24:58] workmad3: axilaris: the only reason they're separate in dev is to ease debugging ;)
[13:25:02] congogr: hold on. i'm trying workmad3 's suggestion too :)
[13:25:06] axilaris: ok, common on app.js and in the asset pipeline directory ?
[13:25:10] congogr: (introducing pluck)
[13:25:25] axilaris: then specific js do it in specific views, is that it ?
[13:25:42] nettoweb: why I cant do a render partial from a file called: _hewcon-2014.html.erb seems that the number at end of file is causing this error
[13:25:42] rushed: axilaris: stop doing specific js :)
[13:26:01] workmad3: axilaris: no, the idea is that all your js is present in application.js and then you use ujs to activate bits of javascript based on the page contents
[13:26:03] axilaris: rushed: obviously i cant stop, there are specific reasons to each page
[13:26:04] nettoweb: Can???t I put number at rnd of the filename?
[13:26:16] mikecmpbll: congogr: i missed the "s" on `joins`, it should be: urrent_user.books.joins("join (select id from books order by created_at desc limit 365) as b on b.id = books.id").maximum(:price)
[13:26:25] axilaris: workmad3: ujs ?
[13:26:26] mikecmpbll: with a c in front ..
[13:26:31] workmad3: axilaris: unobtrusive javascript
[13:26:39] cpruitt: axilaris: Your JS should check the dom for whatever it needs to work with (fields, classes, ID???s etc) and only execute if what it wants is present.
[13:27:00] workmad3: axilaris: it's where you keep your JS out of your HTML and instead activate things like click handlers and page behaviour based on what elements are present in the DOM
[13:27:41] helpa: nettoweb: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[13:27:41] workmad3: nettoweb: !code
[13:28:22] axilaris: need to read about the principles of unobtrusive javascript
[13:28:46] congogr: mikecmpbll , workmad3 .. workmad3 wins this one, as "current_user.books.order('created_at DESC').limit(365).pluck(:price).max" works exactly as it should
[13:29:11] workmad3: 'get it working... then get it fast'
[13:29:21] mikecmpbll: so does mine, you slanderist
[13:29:29] workmad3: mikecmpbll: ;)
[13:29:38] congogr: haha. sowee. in all fairness, i didn't try it with the missing "s" in joins
[13:29:52] axilaris: still a bit unsure, i'ved got pages with some similar dom ids, if all loads into the same, definitely mess up the logic
[13:29:56] congogr: i don't mind this solution at all, btw, even though it will retrieve all prices to then calculate the max locally.
[13:30:02] cpruitt: axilaris: Think of it like this, you have one big .js file with all your code. Lets say you want to display an alert when you click a link in your User???s list. You???d need your users wrapped in a div#user-list or something. Then you???d write JS like: $(???#user-list a???).click(function(){ alert(??????I got clicked) });
[13:30:06] congogr: Guys, you have been massive help. Thanks
[13:30:21] workmad3: congogr: it'll only grab 365 prices
[13:30:31] nettoweb: workmad3: I just put render partial: ???hewcon-2014??? but my file _hewcon-2014.html.erb dont load
[13:31:06] axilaris: cpruitt: got it, just wondering should it be all so unique, i mean it has to if its all loaded up. if thats the way to go
[13:31:21] mikecmpbll: no, it'll grab 365 books
[13:31:36] mikecmpbll: ACTION kills self.
[13:32:26] cpruitt: axilaris: It doesn???t HAVE to be that way, it???s probably just better. Otherwise you???re depending on a close relationship between the JS file and the page that loads it. The fact that the page loaded it is the only indication that it???s running against the right dom.
[13:33:29] nettoweb: workmad3: Im testing somethings, but seems a dash followng a number dont work
[13:33:35] cpruitt: I think you can create additional .js files that load your .js.coffee files. So I think if you create user.js and give it something like //= require user it will load your user.js.coffee file and compile to a separate JS.
[13:33:40] cpruitt: I could be wrong about that though
[13:34:06] axilaris: cpruitt: thx for the advise, if thats the best practice, i should "somewhat: follow it. just having some thoughts on how to restructure it and the benefits of it
[13:34:15] cpruitt: Ten you can use content_for to add that user.js into just the views that want it.
[13:34:21] workmad3: axilaris: I tend towards a style of writing CSS and JS that really doesn't use many dom IDs... when I do use IDs, I tend towards a convention with them so that the id only ends up the same if the behaviour should be the same
[13:34:54] workmad3: axilaris: as cpruitt says, it's not the only way to do it... but it's the way the asset pipeline defaults to
[13:35:34] workmad3: axilaris: and there are certain benefits to that style... but at the 'cost' of having to put more thought into your HTML structuring ;)
[13:35:59] cpruitt: axilaris: The ???best??? way is the way that works for you. maybe you create some additional .js files and then migrate to one larger file controller by controller. I don???t think it???s an ???all or nothing??? deal.
[13:36:18] axilaris: ids can be dangerous if its handled out of scope though
[13:36:26] axilaris: have to be carefully handled
[13:36:28] cpruitt: If you have a 3 mb JS file that is only used on one page of your site used by 2% of the users, I wouldn???t load that into my application.js
[13:37:03] axilaris: cpruitt: thats a very good point
[13:37:21] cpruitt: axilaris: you might consider not using ids. Add classes that clearly indicate what the JS shouldbe paying attention to
[13:37:22] axilaris: but it wont be 3mb
[13:37:44] cpruitt: Yeah, I figured. Just an easy example
[13:37:57] axilaris: there are obvious quite a lot of js coding in nice interactive forms and pages... but max it will be in kb
[13:37:59] cpruitt: Practices aren???t absolute
[13:38:08] workmad3: cpruitt: <3 data-role attributes :)
[13:38:31] cpruitt: workmad3: Good point
[13:38:47] axilaris: ok anyway... back to code, thanks for the thoughtful inputs :)
[13:44:23] mhenrixon: what happened to being able to use symbols as hash keys in controller params?
[13:44:38] mhenrixon: I add params with symbol but get strings back
[13:46:45] mikecmpbll: mhenrixon: wat? code!
[13:47:46] mikecmpbll: i assume you're getting confused by the `inspect` of a hash with indifferent access.
[13:49:17] workmad3: mhenrixon: internally, the HWIA stores keys as strings, not symbols, so as to avoid symbolizing arbitrary user input during parameter processing
[13:49:44] workmad3: mhenrixon: when you access a key with a symbol, the symbol is stringified and used to lookup, thereby providing the indifferent access ;)
[13:50:40] mhenrixon: mikecmpbll not getting confused at all. I have keyword arguments on amount_cents: but that doesn't work because the params send 'amount_cents' from what I can gather
[13:50:50] helpa: mhenrixon: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[13:50:50] workmad3: mhenrixon: !code
[13:50:54] mikecmpbll: mhenrixon: coooooode
[13:51:39] mhenrixon: its coming :)
[13:52:04] chirag7jain: can a object instance method access a variable defined outside its class
[13:54:09] mikecmpbll: chirag7jain: that's not a very specific question, so i'll answer it in unspecific terms. yes.
[13:54:48] chirag7jain: i created a global var. i am having problems accessing it from within a class
[13:54:55] cpruitt: I have some simple middleware and an ApplicationController that overrides url_for. The whole idea here is that OUTput urls (in views) are checked to be replaced with vanity urls. INput urls (invomming request) are checked to switch the vanity url back into a rails route path. https://gist.github.com/cpruitt/b1539c61f380967553de
[13:55:00] mikecmpbll: chirag7jain: !code ?
[13:55:01] cpruitt: I???m normally not a huge fam of premature optimization, but I???d really like to prevent an additional DB query every time I use a url. Is there a good place to cache these values (preferably across a whole application for all users) so that if the same url is used it???s matching pair can be looked up without a trip to the database?
[13:55:22] hypnosb: so like I'm 5, say I want to write a method and connect it to a button. Would I write this in the model? ... How would I write it into the view?
[13:56:01] mhenrixon: Ok fellas check this out https://gist.github.com/mhenrixon/1ee02051ae6462cc822f
[13:56:30] cpruitt: hypnosb: Are you asking how to get started with rails?
[13:56:58] hypnosb: ha well i been through some tutorials.. made the blog but trying to get to the next level
[13:57:25] hypnosb: read a lot of why's
[13:58:55] mhenrixon: mikecmpbll: any ideas on why https://gist.github.com/mhenrixon/1ee02051ae6462cc822f stopped working after upgrading to rails 4.1 from 4.1 rc ?
[13:59:34] cpruitt: hypnosb: Well, in rails you don???t really ???connect??? methods to buttons. If I were you I???d maybe do some reading on the Model View Controller (MVC) pattern so you can get a grasp on what rails is doing.
[13:59:47] mhenrixon: actually I am not sure that was ever working what I did was add keyword arguments instead of hash and it broke. I guess I would have to deep_symbolize_keys to make that work
[14:00:33] Macaveli: I'm trying Laravel for a day oh boy I can see how superior RoR is.
[14:00:45] mikecmpbll: hypnosb: the web browser makes requests to the Rails app, the rails app then determines which controller method to call based upon the URL requested, and it does this based on routing rules that you define in config/routes.rb
[14:01:24] cpruitt: hypnosb: But in general, your links & buttons are going to cause the browser to send a request to the server. That requet will be a combination of HTTP method (e.g. POST) and a URL. Rails uses those things together to match against a route. That route points to a controller and method on that controller. That???s your ???connection???.
[14:03:02] cpruitt: LOL Uh.. yeah, what mikecmpbll said. (Sorry, didn???t mean to be repeatitive)
[14:03:49] hypnosb: so... route, controller (instance method defined for use in views), then methods defined in the model for use in the controller?
[14:04:12] jammanbo: Off the top of your collectively lovely heads, can you force Warden to use a specific strategy for one usage of authenticate!? I don't think scopes are really what I want here...
[14:05:19] karamazov: Man - where do I start with Railscast? The beginning?
[14:05:20] cpruitt: hypnosb: Sorta. Your controller is there to match up the models and views. It creates instances of models and assigns them to instance variables. Those instances of model classes are used in the view to display data.
[14:05:39] cpruitt: Controllers ???controll the interaction??? between other things.
[14:06:12] hypnosb: Ok cool I think I can make it happen
[14:06:38] cpruitt: When in doubt, write whatever code you can & then fix what breaks. :-)
[14:07:08] cpruitt: Unless you???re writing deletes to your file system???. that might warrant some more thoughtful planning. ;-)
[14:10:37] mikecmpbll: mhenrixon: looks like keyword args don't work with HashWithIndifferentAccess: https://gist.github.com/mikecmpbll/bbed6f9a8b80f11e64e9
[14:10:41] mikecmpbll: as you've probably gathered already.
[14:10:57] cpruitt: Sooo??? Not to be repeatitive but, I don???t suppose anyone had any great thoughts on my earlier question about where I can cache simple key/vaue pairs of query results in an application? Google is kinda letting me down.
[14:12:38] mikecmpbll: cpruitt: what do you mean by "key/value pairs of query results"
[14:12:42] adammcarth: Heya. Does anyone know how to marge an array like this?: a1= ["pickup", "pizza"], a2 = ["the", "now"] *DO SOMETHING* #=> ["pickup", "the", "pizza", "now"]
[14:14:31] cpruitt: mikecmpbll: https://gist.github.com/cpruitt/b1539c61f380967553de - I???m trying to efficiently and globally support user defined vanity urls. I???m concerned about DB queries every time I use a url. Once a url is looked up, I???d like to keep the value somewhere I can retrieve it more efficiently than new queries. I???m not familiar enough with rails caching to know if there???s an ???ideal??? way to do for this data.
[14:14:41] cpruitt: Goal is simply to mimimize queries.
[14:14:49] mikecmpbll: adammcarth: a1.zip(a2).flatten is one option
[14:17:29] mikecmpbll: cpruitt: various ways to skin that particular cat, how do you want to handle expiry?
[14:18:50] adammcarth: thanks mikecmpbll!
[14:20:15] adammcarth: never heard of the zip method before...
[14:20:55] mikecmpbll: adammcarth: there's a heck of a lot of useful stuff in Array and Enumerable.
[14:20:57] cpruitt: mikecmpbll: Starting out I was going to clear the entire cache of values whenever a change to a permalink is made or on-demand. It would be **better** to just expire a single entry on update of a db record.
[14:21:44] mikecmpbll: cpruitt: commonest way is to use key-based cache expiration afaik.
[14:23:00] adammcarth: mikecmpbll: I'll have to have a read some day. Cool cohabit gem btw
[14:23:03] cpruitt: mikecmpbll: I???m not too well versed in rails caching yet. Is that held in the same place as view fragments?
[14:23:13] mikecmpbll: adammcarth: it's pretty terrible. i need to rewrite it.
[14:23:40] mikecmpbll: cpruitt: to be perfectly honest, neither am I.
[14:23:41] adammcarth: mikecmpbll: functionality looks useful, didn't look at the code :P
[14:24:23] mikecmpbll: adammcarth: the code is okay, the design of it sucks, it's all too magical, and in practice it doesn't work very well.
[14:24:57] cpruitt: mikecmpbll: No prob. Thanks for the help all the same. :-)
[14:24:59] adammcarth: mikecmpbll: Eh, I still want to try it out now
[14:25:16] mikecmpbll: adammcarth: at your own peril.
[14:25:24] webgen: I have array = Array.new(5), can u give me a short example on how to insert an int inside?
[14:26:17] adammcarth: webgen: Do you actually want an array with [nil, nil, nil, nil, nil]?
[14:26:39] webgen: adammcarth, i want array with ints from 1 to 5 :P
[14:26:45] mikecmpbll: webgen: it's not common to instantiate arrays with a size in Ruby
[14:27:11] mikecmpbll: webgen (1..5).to_a or simply [1,2,3,4,5]
[14:27:35] adammcarth: webgen: The array variable in your example would be [nil, nil, nil, nil, nil] which, as mike pointed out, is basically pointless in Ruby
[14:29:15] webgen: mikecmpbll, i wanted to use a loop to do it so i want to insert ints one by one :)
[14:29:21] adammcarth: webgen: or if you wanted to do something really funky
[14:29:30] adammcarth: num = params[:num]
[14:29:37] adammcarth: (or num = 5)
[14:29:59] adammcarth: 5.times do { |n| array << n + 1 }
[14:30:06] webgen: adammcarth, i wont get wet there yet :D :D I am blurry about params method so far
[14:30:09] adammcarth: num.times do****
[14:30:26] adammcarth: Haha, hang on - I'll send you a gist of looping through
[14:30:35] webgen: adammcarth, ye I tried inserting with << and codeacademy tells me array isnt 1..5 ... :D ...
[14:31:40] adammcarth: webgen: https://gist.github.com/adammcarthur/11217545
[14:31:59] webgen: https://gist.github.com/anonymous/11217549 whats wrong with this basically
[14:33:23] adammcarth: webgen: Ehh, that's not the cleanest way of doing it
[14:33:41] adammcarth: do you understand mine?
[14:33:54] mikecmpbll: that's such un-ruby-like ruby code.
[14:34:23] webgen: adammcarth, i know but first i am in stone age just trying to understand syntax :P
[14:34:25] webgen: https://gist.github.com/anonymous/11217649
[14:34:59] adammcarth: webgen: All good, how long have you been programming for?
[14:35:19] webgen: well for about 2 years in java in college
[14:35:40] mikecmpbll: why use ruby if you're going to use 10 lines to do something you can do in 11 characters.
[14:35:42] adammcarth: webgen: Your first problem in the first gist is that you just set array to Array instead of Array.new
[14:35:52] webgen: this is much easier than java but syntax still requires knowledge :P
[14:36:05] adammcarth: webgen: but you just fixed that I notice
[14:36:48] webgen: ok i ll post a final version and i ll say codeacademy tells me i am wrong one sek
[14:37:53] webgen: adammcarth, https://gist.github.com/anonymous/11217833
[14:38:12] webgen: adammcarth, Oops, try again. It looks like my_array isn't equal to [1,2,3,4,5]. is it codeacademy that is retarded?
[14:38:24] adammcarth: your code outputs
[14:38:33] mikecmpbll: webgen: the first thing you're adding to the array is 0
[14:38:53] webgen: mikecmpbll, dam it ...you are right
[14:38:55] mikecmpbll: you're literally doing counter = 0, then my_array << counter, what do you expect? :)
[14:39:13] webgen: mikecmpbll, worked perfetto :D
[14:39:28] adammcarth: dayuuum, I got showed up real good
[14:39:39] webgen: ok thanks so much I hate these kind of "being stuck lmfo"
[14:39:54] GeekOnCoffee: anybody watching the Railsconf keynote?
[14:40:08] adammcarth: Nope, is it being live streamed GeekOnCoffee?
[14:40:22] GeekOnCoffee: adammcarth: yes, http://www.justin.tv/confreaks
[14:40:37] nateberkopec: GeekOnCoffee: I'm trying, but justin/tv isn't loading r/n
[14:40:48] GeekOnCoffee: hmm working well for me, compared to yesterday
[14:40:58] GeekOnCoffee: but I???ve got no clue what Yehuda is saying, so you aren???t missing much
[14:41:03] GeekOnCoffee: he lost me at cookies
[14:41:32] adammcarth: GeekOnCoffee: I'm the guy on the right
[14:43:58] adammcarth: GeekOnCoffee: Is this talk about programming or the meaning of life?
[14:44:10] GeekOnCoffee: mostly the meaning of life, I think
[14:44:15] GeekOnCoffee: like I said, he lost me at cookies
[14:44:39] GeekOnCoffee: his keynotes tend to be that way, for some reason??? I???m not a huge fan??? there are many people who do non-tech talks better
[14:45:07] adammcarth: GeekOnCoffee: I've never seen a talk on anything to do with programming before :P
[14:45:17] GeekOnCoffee: adammcarth: really?
[14:45:17] adammcarth: didn't no they live streamed these
[14:45:31] adammcarth: GeekOnCoffee: Yep. :)
[14:45:46] GeekOnCoffee: so find a conference and go
[14:45:47] GeekOnCoffee: but until then
[14:47:07] GeekOnCoffee: adammcarth: haven???t watched this talk, but it looks programmingish, and any talk by tenderlove is worth watching: http://confreaks.com/videos/3269-mwrc-a-magical-gathering
[14:47:12] adammcarth: GeekOnCoffee: Haha, nah I'm in my final year of highschool - can't seem to find the time
[14:47:35] GeekOnCoffee: and confreaks is great in general, lots of incredible talks from a wide variety of conferences
[14:47:40] adammcarth: I've seen some of tenderloving's comments online, he's so funny
[14:49:50] adammcarth: GeekOnCoffee: At least I understood the life part
[14:55:27] gabeodess: Can anyone help me with this? https://gist.github.com/CitySprout/11218536
[14:55:43] gabeodess: I can???t seem to figure out translations for my error messages
[14:55:58] gabeodess: specifically changing a model name
[15:32:44] h1bertobarbosa: Hello can anyone help me? the devise is generating this error: "NoMethodError: undefined method` query 'for nil: NilClass: SHOW FULL FIELDS FROM `users` "
[15:40:15] LastWhisper: i'm refactoring a controller and was wondering if you guys could help me out w/ something
[15:40:24] LastWhisper: I want to know, when I call this one method in the controller
[15:40:28] LastWhisper: which before_actions were called on it
[15:40:40] LastWhisper: is there a way to cleanly output those calls?
[15:45:46] torstein: Fun Active Record Query Question: Task belongs_to Section, Task habtm Checklist. How do ask for tasks nested under section which only belong to a certain checklist? Something like this: Section.includes(:tasks).where("checklist.id" => 4)
[15:46:23] torstein: the view expects @sections and loops through each sections tasks
[15:49:06] timgauthier: how do you use an assethelpter image tag in scss files?
[15:49:14] mikecmpbll: torstein: probably something like Task.joins(:checklists, :section).where(sections: { id: @sections }, checklists: { id: 4 })
[15:50:01] mikecmpbll: timgauthier: http://guides.rubyonrails.org/asset_pipeline.html#coding-links-to-assets
[15:50:17] timgauthier: thanks.. the other ones i found where confusing. this may help
[16:10:28] mdw: is it possible for the rails select helper to include an option to set my document_folder_id to nil? If i use the include_blank: true option, the folder_id is not modified :-(
[16:10:29] mdw: https://gist.github.com/pita5/8fd45ec0d3664fcdf273
[16:11:22] mdw: if I use {:include_blank => true}, choosing blank does nothing to the folder_id
[16:14:29] gabeodess: mdw: are you putting the options inside options_for_select?
[16:15:22] mdw: gabeodess i was using http://apidock.com/rails/v4.0.2/ActionView/Helpers/FormOptionsHelper/options_from_collection_for_select
[16:16:38] barhum2013: Hello, I am having an issue passing a test in my spec. My code works fine in the development but I have no idea why my test is not passing. https://gist.github.com/barhum/c25b494d50e95a911a09
[16:17:20] gabeodess: mdw: hmm, yeah, I recall having that issue in the past, but I thought it seems to be fixed in later versions of rails
[16:17:58] mdw: ahh, this is not expected behaviour ?
[16:23:44] gabeodess: mdw: if you select blank and submit the form what do your params look like?
[16:24:29] mdw: gabeodess my bad, I think some of my stronger parameters were blocking this :-)
[16:24:33] mdw: sorry about that!
[16:24:35] mdw: fixed it
[16:25:45] spamotuve: Hello, I'm having this issue with nokogiri http://stackoverflow.com/questions/23250138/scraping-with-nokogiri-and-saving-in-array
[16:26:08] spamotuve: do any of you have an idea why I get that weird array?
[16:30:45] bricker`LA: spamotuve: that's the serialized version of the Element object (into YAML). It looks correct.
[16:31:02] spamotuve: bricker`LA: ok, and how can I deserialize it then?
[16:31:30] bricker`LA: spamotuve: YAML.load(participant.surname)
[16:33:00] spamotuve: bricker`LA: wouldn't it be more correct to use s.surname? and in that situation 'surname' is an undefined method
[16:34:27] bricker`LA: I guess it's not correct then
[16:37:27] gabeodess: can anyone help me with this? https://gist.github.com/CitySprout/11218536
[16:37:38] gabeodess: having trouble with internationalization
[16:38:26] cgcardona_: hi. I have an app on heroku and I'm trying to allow a user to upload a favicon for their profile page. It works correctly on my local dev environment but when I push to stage on production it fails w/ the following error `ActionView::Template::Error (favicon.ico isn't precompiled):`. All precompilation is happening during the deploy to heroku so I'm unclear on how to precompile an .ico file being uploaded on the fly. I am usi
[16:38:27] cgcardona_: the same Paperclip/S3 setup as my other images which the user can upload and it isn't happening to any of them. Thanks in advance for any advice.
[16:38:42] cgcardona_: *push to stage on heroku
[16:42:50] Criten: cgcardona_: you shouldn't go through the pipeline for uploaded files
[16:44:28] cgcardona_: I didn't realize that I was I guess. I just am using paperclip to allow a user to attach a file (in this case .ico) to something they has_many of. Then i'm creating the favicon w/ = favicon_link_tag @launch_page.favicon.url. Forgive the question if the answer is obvious but which part is going through the asset pipeline? Or how do I have an uploaded image *not* go through the asset pipeline?
[16:44:45] cgcardona_: Like I mentioned above the same flow works fine for user uploaded images and such. Only the .ico causes a fail.
[16:45:00] batesism: Hey guys... I'm building a music chart, and right now am using counter_cache and sorting songs by # of votes... Is there a way I can specify that only votes within the last week should be counted?
[16:50:02] Tzeejay: Hey guys, I'm looking for a good encyption gem to encrypt passwords. I'm new to Rails but I heard of bycrypt. Any other suggestions or better alternatives? If yes why?
[16:52:32] cgcardona_: Tzeejay: encryptor is nice https://github.com/attr-encrypted/encryptor
[16:56:14] mdw: if I use the default value in options_from_collection_for_select with @document.document_folder.id sometimes this folder is nil, so it'll crash. Is there an easy way to test for the presence of this value without it crashing?
[16:56:18] mdw: https://gist.github.com/pita5/47c8e1e467fcac90965a
[16:56:44] mdw: I could surround this select statement in an if @document.document_folder.present? but that seems ugly?
[16:57:24] cgcardona_: Tzeejay: np :)
[16:59:40] gabeodess: mdw: validate :folder_id, :presence => true
[17:00:05] mdw: gabeodess, but it's OK for the folder_id to be nil... some files aren't in a folder :-D
[17:01:34] gabeodess: mdw: @document.document_folder.try(:id)
[17:01:44] mdw: I didn't know about try
[17:02:57] rhizome: or you could just use an instance variable from teh controller
[17:03:11] mdw: .try looks really good
[17:03:14] rhizome: and really, why would a folder not have :id?
[17:04:09] rhizome: it's still wonky
[17:04:22] mdw: why's that? :-)
[17:04:28] mdw: i'm a nooby...
[17:06:30] gabeodess: mdw: I think you want @document.document_folder_id
[17:07:01] mdw: hmmm that works toO!
[17:07:08] mdw: what's this doing?
[17:07:22] gabeodess: mdw: it???s a lot cleaner than try
[17:07:32] mdw: what's the difference between .try(:id) and _id ?
[17:07:48] gabeodess: mdw: usually if you have to use try, you???re doing something wrong
[17:08:08] mdw: i see :-) I'll avoid that then..
[17:08:11] gabeodess: document_folder_id is a column in your documents table
[17:08:36] mdw: what feature of rails enables that type of syntax?
[17:08:49] gabeodess: mdw: it???s okay to use in a jam, but if you???re using it, you might want to take a step back to see if there???s a better option
[17:09:16] gabeodess: mdw: it???s not any special syntax, it???s just an attribute of your Document model
[17:09:50] gabeodess: if you look at your database schema you???ll see document_folder_id as one of the columns
[17:10:08] gabeodess: that???s how models are associated in the database
[17:10:59] mdw: I see, thanks!
[17:13:03] gabeodess: mdw: also, using an attribute of @document is lighter than loading a whole new object (document_folder) to get the same information.
[17:14:02] BlueInk: Hello, I have a problem setting an attribute of my model in my ActiveRecord. My function gen_hash doesn't get called. Is there a good resource how to write custom functions? I am really glad for any help. Thanks
[17:14:52] gabeodess: BlueInk: !vague
[17:16:10] mdw: gabeodess makes sense, I dread to think how bad my app with regards to optimal ruby...
[17:16:23] lethjakman: GeekOnCoffee: Have to thank you for that tonx recommendation. good stuff!
[17:16:24] mdw: thankfully, this is the first release, optimise later :-D
[17:16:35] GeekOnCoffee: lethjakman: glad to hear it :)
[17:16:49] lethjakman: can't believe how fast and easy they are!
[17:17:03] lethjakman: best flavor out of any one I've put through my coffee pot yet
[17:17:18] BlueInk: gabeodess: How can I be more precise?
[17:18:03] gabeodess: BlueInk: maybe post a gist of what you???ve tried and the output you expect and the output you???re getting
[17:26:27] nahtnam: Im not sure what this does. https://github.com/plataformatec/devise/wiki/How-to:-Scope-login-to-subdomain
[17:27:29] lethjakman: nahtnam: cookies are subdomain specific a lot of the time.
[17:27:44] lethjakman: nahtnam: so even if you log in on mywebset.com blah.mywebsite.com may have a different session coookie
[17:27:54] nahtnam: lethjakman: Ohhhh ok. Thanks
[17:28:39] BlueInk: gabeodess: https://gist.github.com/InfInt/11225083
[17:29:19] lethjakman: nahtnam: np :)
[17:31:34] gabeodess: BlueInk: the controller is only is your connection for network requests through a browser. Since you are sending a create request directly to the model in your console, the controller method is never called.
[17:31:40] zmbmartin: Is there a reason that files in my asset.paths folders would not get precompiled?
[17:32:04] zmbmartin: I see app/assets/fonts in my path. Some of the fonts are there but a few of them are not.
[17:32:36] gabeodess: BlueInk: if you want to run gen_hash every time before you create an invitation you should add a before_create block in your model instead of trying to do it in the controller
[17:34:33] BlueInk: gabeodess: I try it right now ;)
[17:41:00] gabeodess: zmbmartin: depending on your settings you may need to add them to a precompile list in application.rb
[17:42:00] louism2wash: Hey guys, I am have a model that accepts nested attributes for a child model and I am trying to figure out how to customize the key in the errors hash for the parent object: https://gist.github.com/louism2/11225483
[17:42:28] louism2wash: I don't want the parent model appended to the front of the attribute name
[17:43:55] relix: using erb to create a plain text mail is annoying
[17:43:58] relix: can't use indenting etc
[17:44:10] relix: is there a solution or a better way to generate text mails?
[17:46:06] gabeodess: louism2wash: try my_object.errors.to_hash
[17:46:51] BlueInk: What is the best way to ensure that an attribute is unique?
[17:47:10] louism2wash: relix: I think you can link to a style sheet in your html.erb templates
[17:47:23] louism2wash: <link href="/assets/mailers.css?body=1" media="all" rel="stylesheet" type="text/css" />
[17:47:37] louism2wash: gabeodess: I'll give that a shot
[17:48:25] gabeodess: louism2wash: the real solution is to use internationalization, but I can???t figure how to overwrite the key, I have to write an entry for each attribute
[17:48:28] relix: louism2wash yes you can, but that is irrelevant, i'm not generating html here
[17:50:03] gabeodess: louism2wash: https://gist.github.com/CitySprout/11225869
[17:50:35] gabeodess: BlueInk: validate :my_attribute, :uniqueness => true
[17:58:06] louism2wash: gabeodess: I'm not super familiar with internationalization. Is this what I am after? https://gist.github.com/CitySprout/11225869
[17:58:38] BlueInk: gabeodess: Can I put this in a while !validate to regenerate my qr_hash. I am really sorry, but I am not so fluent in rails, yet.
[17:59:12] gabeodess: louism2wash: yeah, that looks right
[18:00:01] louism2wash: gabeodess: ok, let me monkey around with it. Thanks for the help
[18:02:19] gabeodess: louism2wash: mine looks like this with underscores: https://gist.github.com/CitySprout/11225869
[18:02:37] gabeodess: louism2wash: assuming a has_many relationship
[18:02:45] drager: How can I insert data into two tables at once? They have a relationship. This is what I've tried; https://dpaste.de/NyHE
[18:03:15] louism2wash: gabeodess: it has a 'has_one' relationship
[18:04:16] gabeodess: louism2wash: okay, so maybe it should be bid/staging_job, play around with it
[18:10:54] gabeodess: BlueInk: while !valid?
[18:12:23] BlueInk: while !uniqueness gen_hash ??
[18:16:15] gabeodess: BlueInk: while !Invitation.where(:hash => hash).exists?
[18:17:10] gabeodess: or rather while Invitation.where(:hash => hash).exists?
[18:19:03] rightisleft: howdy - im trying to understand why i cant use a gem in my erb files. I installed 'table_for' in my gemfile, and ran bundle install. I can step into the gem in RubyMine, and it shows ups in $gem list. However, when i try and execute it in my foo.html.erb file - i get NoMethodError in DemoTable#show - on <%= table_for @users do -%>
[18:20:55] artichoke: I'm trying to figure out why some url helpers are returning incorrect paths. Example: link_to "change password", [:change_password, @user]. This will return a href along the lines of: /cms/assets?action=change_password&controller=cms%2Fusers&id=47 when it should be /cms/users/47/change_password. I'm inspecting the polymorphic_url helper in actionpack and see that it gets a named route called change_password_user_path which matches what I see when I
[18:20:55] artichoke: (change_password_user GET -> cms/users#change_password). Does anyone have any ideas?
[18:24:15] savish: When a user has many blogs a blog belongs to user, what is the model command, so User.something to create a new blog?
[18:25:29] Criten: User.blogs << blogobject
[18:25:49] Criten: or blog.user = userObject
[18:26:11] savish: That would get me my set of blogs right?
[18:26:18] savish: but what if I want to create a blog through a user?
[18:26:23] savish: to validate the relationship
[18:26:33] savish: so Like User.Create ....
[18:26:35] savish: or something
[18:27:02] Criten: userObject.blogs << blogObject
[18:27:47] Criten: adds the new blog to the user's blogs
[18:28:07] centrx: savish, You can also use nested attributes
[18:28:21] savish: wait ..... How does that help me create a blog for user? So lets say I do: sally = User.create(name: 'sally'), Sally.create_blog?
[18:28:24] savish: like that
[18:28:25] Criten: blog = Blog.create then you can do userObject.blogs << blog
[18:28:36] savish: that makes sense
[18:28:45] Criten: If you want to do both at the same time, you can use nested attributes with a form or something
[18:28:48] Criten: up to you
[18:29:00] savish: Im testing a model relationshio
[18:29:07] savish: so there is no forms or controllers right now
[18:29:39] savish: I just want to say: User A create a blog in the blog model to then validate that the blog created has a user_ids that is User A's
[18:29:48] savish: but im not sure how to create a blog through a user at the model level
[18:29:57] savish: I know User.create
[18:29:59] savish: and Blog.create
[18:30:02] Criten: yeah, do both
[18:30:10] Criten: then relate the two
[18:30:18] jpstokes: savish: it's probably more like User.find_by_name('Sally').blog.create
[18:30:31] savish: jpstokes, thats what I wanted (if its simmilar to that)
[18:31:00] jpstokes: yeah that should create an assoication for you
[18:31:51] savish: thank you
[18:31:55] savish: sorry for being confusing
[18:39:16] the_f0ster: I want to override the datetime to_s in my app, where is an appropriate place (on the filesystem) to put the class def/method override like in this example here, http://stackoverflow.com/questions/5368984/how-to-change-datetime-in-xml-response-using-rails3 ?
[18:40:45] tweeeaks: has anyone integrated spree with FirstData? or seen it done anywhere? active_merchant supports them, but the spree_gateway gem doesn't come packaged with it
[18:41:51] Senjai: tweeeaks: There is a spree channel, in #spree
[18:42:13] Senjai: tweeeaks: Also, it's fairly easy to make a spree gateway if one exists for active merchant, there are some good docs on the spree commerce website on this
[18:42:16] tweeeaks: Senjai: ahh crap, i knew that too -- thanks
[18:54:16] mdw: is something like this possible in rails? I'm trying to add a member action to my documents. Passing in the parameter 'folder_id' prevents the route being given a name in rake routes
[18:54:20] mdw: https://gist.github.com/pita5/e6e92fff5e3b3befa139
[18:54:57] bricker: mdw: pass the :as option
[18:55:57] mdw: bricker I don't understand :-(
[18:56:21] mdw: so I can give it a name
[18:57:44] mdw: bricker thanks
[18:58:02] _lazarevsky: I wanna create a cron job
[18:58:11] _lazarevsky: can you suggest an easy-to-use library?
[18:58:18] _lazarevsky: thanks so much
[18:58:22] bricker: _lazarevsky: whenever
[18:58:51] _lazarevsky: bricker: now would be perfect :)
[18:59:10] bricker: _lazarevsky: http://rubygems.org/gems/whenever
[18:59:18] _lazarevsky: HAAAAHHAHAHAHAH
[18:59:31] _lazarevsky: lol'd SO HARD!!!!
[18:59:55] _lazarevsky: thanks broseph
[19:03:04] jpstokes: question is this a bad thing in rails?: some_array.try(:empty?)
[19:03:15] bricker: jpstokes: yes
[19:03:32] jpstokes: I find doing this is much easier than doing some_array && some_array.empty?
[19:03:42] bricker: jpstokes: why would some_array be nil?
[19:03:58] jpstokes: bricker: was is it? I've heard it is bad before but don't understand why
[19:04:23] jpstokes: well in code sometimes it is
[19:04:31] jpstokes: if it hasn't been initialized
[19:04:41] bricker: jpstokes: because you should know what types of objects you're working with.
[19:04:55] bricker: jpstokes: if you must, Array(some_array).empty? is better
[19:05:24] bricker: jpstokes: I only use that if I'm doing something like some_array[5..10] where there may not be that many elements in the array
[19:05:25] jpstokes: hmmm...i guess that makes since...so basically an array or hash should never be nil so in cases where they are I need to make sure I at least initialize them
[19:05:38] jpstokes: since = sense
[19:12:49] bloopletech: In rails 4, what's the correct way to write my respond_to block so that both ordinary requests and AJAX requests both end up in the format.html block? I'm rendering a paginated results table and for the AJAX requests, want to just render the new table (cf. rendering the whole page)
[19:13:01] bloopletech: My google-fu is being weak and not finding me a solution
[19:14:23] BlueInk: is there a blob as column type? Or do I have to use base64-strings?
[19:14:26] bloopletech: The behaviour I'm seeing at the moment is that Rails thinks I want a JS response; so if I just have a format.html block then Rails looks for a .js template (which doesn't exist)
[19:15:20] bloopletech: BlueInk, perhaps the :binary type?
[19:15:38] slash_nick: bloopletech: if request.xhr?;...;else respond_to do |format|;...;end;end;...
[19:15:48] BlueInk: bloopletech: thank you
[19:16:24] bloopletech: slash_nick, hmm ok. Is that the railsy way to do this? Or is the underlying pattern I'm following wrong?
[19:16:35] bloopletech: (thank you btw)
[19:18:51] slash_nick: bloopletech: what's your existing action look like?
[19:21:51] bloopletech: basically, params[:q] ||= {}; @q = Blah.search(params[:q]); @blah_results = @q.result.page(params[:page]); then the respond block, which has an empty csv format block and had a html format block that rendered the table partial if request.xhr?
[19:22:35] bloopletech: (this is the index action for the controller in case it wasnt obvious)
[19:23:56] bloopletech: and the main index view has a header and the search filter form etc. and then renders the table partial; the js we have for our tables takes the kaminari pagination links and turns them into ajax requests to the same action (e.g. /blah/blah?page=2)
[19:25:02] slash_nick: bloopletech: then you have some code then something like this: https://gist.github.com/rthbound/900df82badc074793fe2 ?
[19:25:12] melkor: I have a model class MyReport < ActiveRecord::Base that has a field belongs_to :user. The problem is the user has been deleted, is there a way to make the report load an 'unknown' user instead of a nil class?
[19:25:57] slash_nick: melkor: check into "null object pattern"
[19:26:16] bloopletech: huh yeah, exactly that, but (1) no json format because there's no web service going on here and (2) the layout :false is automatically set at the ApplicationController level per-request
[19:26:32] slash_nick: bloopletech: then what's the question?
[19:27:23] bloopletech: slash_nick, oh, no question, just want to make sure I'm doing things the right way ;). moving the reuqest.xhr outside the respond_to works perfectly! :)
[19:28:07] bloopletech: thanks for your help
[19:28:20] slash_nick: curious, did you try format.js { render partial: 'this_controller/index' }
[19:29:17] bloopletech: yeah, Rails renders the response all right, but gives it Content-Type: application/json or javascript or somesuch; which jQuery probably tries to interpret as JS instead of HTML
[19:31:28] slash_nick: bloopletech: while it's okay to do it the way we are, it might be better to replace the server side partial with a client side template... then you'd want to return json rather than html
[19:31:35] nahtnam: Hello. I put this: @test = Project.first in my controller. I dont know how to put it in the view. I have tried this: <% @test.title %> and <% @test %>. I am just starting to learn about Active Record
[19:32:01] bloopletech: slash_nick, hmm yeah I'll take that on board
[19:32:22] bloopletech: nahtnam, <%= instead of just <%
[19:32:30] nahtnam: bloopletech: Oh lol
[19:32:48] nahtnam: Thank bloopletech!
[19:45:44] omosoj: Hey guys, I'm learning Rails. Is it true that working with databases is one of the most important skills to have?
[19:46:50] melkor: Thanks, now I've got to fix this problem from the root and prevent users from getting deleted.
[19:47:20] nahtnam: omosoj: Yeah, i guess
[19:47:24] nahtnam: Its very useful
[19:47:33] nahtnam: and you will actually be able to store data
[19:47:38] nahtnam: besides an array
[19:48:28] omosoj: nahtnam, what kind of programs or apps don't require data storage?
[19:48:41] nahtnam: omosoj: Hello World
[19:54:05] ratmav: I'm on Ubuntu 12.04, and I built Ruby from source
[19:54:17] ratmav: Now, when I try to install bundler, it won't install without sudo.
[19:54:45] ratmav: Also, when I try to install local gems (bundle package/bundle install --local), none of my gems appear to be found.
[19:55:11] ratmav: What should I be doing differently?
[19:55:16] andywww: how might i go about mining the config documentation for typhoeus to get proxy password details?
[19:55:23] lethjakman: ratmav: which bundle
[19:55:24] andywww: I actually cannot find it anywhere
[19:55:32] lethjakman: try that command and lemme know the path.
[19:56:09] ratmav: lethjakman, $ sudo gem install bundler to get bundler installed
[19:56:12] lethjakman: ratmav: when I have that issue usually the paths are set up wrong or it's using a system version of bundle rather than the built in one.
[19:56:25] ratmav: lethjakman, /usr/local/bin/bundle
[19:56:31] lethjakman: ratmav: yeah that's the wrong one
[19:56:42] lethjakman: er....actually. where is gem installed?
[19:56:47] lethjakman: sorry I'm making assumptions
[19:57:01] ratmav: lethjakman, /usr/local/bin/gem
[19:57:09] spamotuve: 2.0.0-p353 :001 > p = Participant.paginate(:per_page => 5, :page => 1) Participant Load (1.3ms) SELECT "participants".* FROM "participants" LIMIT 5 OFFSET 0 => #<ActiveRecord::Relation []>
[19:57:17] ratmav: lethjakman, this box *did* have rvm installed, but i ripped it out to match a prod setup
[19:57:17] spamotuve: how come I keep getting that activerecord thing
[19:57:26] spamotuve: in stead of a list of people?
[19:57:32] spamotuve: using will_paginate
[19:57:39] lethjakman: ratmav: I'd actually recommend rbenv for prod/dev tasks.
[19:57:48] lethjakman: that's how I've had the best luck.
[19:57:48] ratmav: lethjakman, in the prod environment, i don't have access to rubygems.org, etc. very limited network access.
[19:58:19] lethjakman: what is the exact requirement there?
[19:58:22] _lazarevsky: bricker: whenever is super cool man! Thanks so much! Can you recommend a very use to setup and use library for xml generation
[19:58:38] ratmav: lethjakman, i need the whole environment to be something i can tar up and scp over
[19:58:49] ratmav: so, bundle package, tar up the repo, scp
[19:59:06] ratmav: scp over the source for the appropriate ruby version (configure, make, make install)
[19:59:10] lethjakman: hmmm. that's a rather odd way to do that.
[19:59:20] ratmav: lethjakman, learning as i go
[19:59:22] lethjakman: are you trying to protect against DNS attacks?
[19:59:37] ratmav: hospital it paranoia mostly.
[19:59:41] lethjakman: I'm curious what having access to rubygems has to do with hipaa
[19:59:49] ratmav: see previous
[20:00:04] lethjakman: yeah. doesn't sound like an actual requirement to me. but if that's how they have you do it...
[20:00:09] lethjakman: you're right in installing them locally.
[20:00:10] bricker: _lazarevsky: http://rubygems.org/gems/builder
[20:00:10] ratmav: very little leverage with customer security group on that. opening ports can take literally years
[20:00:37] ratmav: yeah, it's not a technical issue. not my football to toss.
[20:00:47] ratmav: but the workaround *is* my football to toss.
[20:00:48] _lazarevsky: bricker: i've come across nokogiri, I thought it was like a de-facto standard among the ruby community
[20:01:12] bricker: _lazarevsky: it is, but it doesn't meat your "very easy to setup and use" condition
[20:01:15] ratmav: nokogiri is pretty standard
[20:01:18] mikecmpbll: any ubuntu users know why, after changing the timezone, logs and cron are still using the old one?
[20:01:26] ratmav: he could try REXML, but that's not as pleasant
[20:01:41] ratmav: still, easy b/c part of standard ruby lib
[20:02:15] lethjakman: ratmav: hmmm, anyway. I think the issue is coming from your permissions on your gems directory
[20:02:38] lethjakman: you'd either have to locally chown it because you DO have to install bundler somehow, sudo install bundler, or use rbenv locally since that should still work with a local install of gems.
[20:02:41] ratmav: silly question: where *should* those gems be in a built-from-source install?
[20:03:02] ratmav: yeah, i'm starting to think that having rvm on this box before is creating havoc
[20:03:22] _lazarevsky: bricker: why do you say nokogiri isnt easy to setup?
[20:03:33] mikecmpbll: nvm restart did the job.
[20:03:34] ratmav: hopping on the prod box to see what which bundle and which gem return
[20:03:35] lethjakman: honestly...I don't know. I NEVER do it that way. plus I'm on OSX with ruby generally.
[20:03:43] lethjakman: did you check your paths?
[20:03:48] lethjakman: if it's messed up from RVM that would be wh y.
[20:03:55] lethjakman: compare the two paths.
[20:03:56] bricker: _lazarevsky: it just has a steeper learning curve than the other options, it's not that hard though
[20:04:56] _lazarevsky: I have an array or elements (hashes)
[20:05:00] lethjakman: mikecmpbll: hmmm....that's good to know. glad you m entioned that.
[20:05:05] _lazarevsky: for each of them I need to add a new xml node
[20:05:24] _lazarevsky: glanced at the examples of nokogiri and builder and I gotta say, nokogiri syntax seems much easier to me :)
[20:05:38] lethjakman: mikecmpbll: do you use whenever btw?
[20:05:45] mikecmpbll: lethjakman: nope.
[20:05:48] lethjakman: makes cron way nicer.
[20:05:56] mikecmpbll: nah, i looked at it once, didn't fancy it though
[20:06:02] lethjakman: I just like it for deploy processes
[20:06:07] lethjakman: automatically updates it for me :)
[20:06:38] mikecmpbll: yeah, can be handy i guess. in my case i don't want my cronjobs tied to my app.
[20:06:49] mikecmpbll: or rather, i don't have any cron jobs that i want tied to my app*
[20:06:55] ratmav: lethjakman, paths match what's in prod. i think this is post-rvm oddness.
[20:06:59] lethjakman: there are definitely times where that'd be inappropriate.
[20:07:44] lethjakman: ratmav: ruby -r rubygems -e "p Gem.path"
[20:08:18] jon30: using jbuilder view, how do i make a nested output that looks like this: 1: { name: "bob" }, 2: {name "jack"} ..basically the number is the ID of the record. instead of {id: 1, name: "bob"}...etc
[20:08:23] lethjakman: your issue is you rgem path is probably system.
[20:08:31] lethjakman: jon30: array!
[20:08:31] ratmav: lethjakman, OK. i have the path form gem enc
[20:08:41] lethjakman: ratmav: where is it?
[20:08:48] lethjakman: I'm betting it's the permissions on it.
[20:08:51] ratmav: note: sudo bundle install --local says it installs the gems
[20:08:54] lethjakman: do you not have sudo privledges on this box?
[20:09:03] ratmav: gem list only returns bundler
[20:09:08] ratmav: yes, i have admin rights
[20:09:14] ratmav: just trying to sort out what's broken
[20:09:17] savish: any one know why: User.find_by_first_name(@user.first_name).blogs.update(name: 'Sample') would require two arguments? when name is the only field in the table?
[20:09:51] ratmav: lethjakman, bundler is where i'd expect
[20:10:05] ratmav: it's in the proper folder referenced by gem env
[20:10:07] lethjakman: ratmav: the issue is the fact that it's asking for sudo to install gems correct?
[20:10:10] ratmav: but the other gems are not
[20:10:16] ratmav: some gems, like passenger
[20:10:21] ratmav: also bundler
[20:10:25] lethjakman: --local I believe installs it in the current directroy
[20:10:32] lethjakman: so...you'd run that in your app directory
[20:11:31] ratmav: lethjakman, ok. that must be where i'm confused.
[20:11:41] ratmav: i ran bundle package to get all of my gems in the project tarball
[20:11:50] ratmav: now, i have the tarball on the box
[20:12:01] savish: nvm I had to first find the blog.
[20:12:14] ratmav: i've been running bundle install --local to install my gems using the local .gem files. that doesn't seem to be correct.
[20:13:52] ratmav: lethjakman, i was using this doc: http://bundler.io/v1.6/bundle_package.html
[20:14:00] mikecmpbll: yeah, that's correct.
[20:14:20] mikecmpbll: ratmav: what problem are you having?
[20:14:47] ratmav: mikecmpbll, bundle package to have a local copy of .gems in the project to put in a tarball
[20:14:49] ratmav: scp tarball
[20:15:08] ratmav: decompress tarball, then bundle install --local --without devevopment test to install gems
[20:15:10] mikecmpbll: that doesn't read like a problem to me
[20:15:48] mikecmpbll: rather a description of a process.
[20:16:06] ratmav: which rails outputs nothing
[20:16:33] ratmav: i do have to use sudo gem install bundler to install bundler
[20:16:36] mikecmpbll: have you done the process you just described, is that what you're saying?
[20:16:53] mikecmpbll: what happened when you bundle installed.
[20:17:10] ratmav: first, i get errors without sudo (not main issue)
[20:17:25] ratmav: sudo bundle install ... i get output like the gems are being installed
[20:17:34] ratmav: which rails gives me nothing
[20:17:42] mikecmpbll: probably cus you installed as sudo.
[20:18:04] ratmav: mikecmpbll, perhaps. not convinced. not an issue on other boxes.
[20:18:40] mikecmpbll: type sudo which rails
[20:18:50] mikecmpbll: you won't be surprised at the output, i'm sure.
[20:19:15] ratmav: to be fair, that's the first thing i was thinking
[20:19:37] ratmav: in dev/test, i can get away with using rvm or rbenv
[20:19:40] mikecmpbll: bundle show rails ?
[20:19:59] ratmav: ah, that's a good command. i just tracked that down by hand
[20:20:24] ratmav: my gems (in vendor/cache), are being installed to vendor/bundle/ruby/1.9.1/gems
[20:21:03] ratmav: bundler is looking in /usr/local/lib/rubygems/1.9.1
[20:21:10] ratmav: so, that explains the issue
[20:21:34] ratmav: but i'm not sure how i got here. this box *did* have rvm installed, but i ripped it out (implode) to match a prod setup.
[20:21:49] ratmav: prod setup is fine; testing other issues. just trying to lab something up
[20:21:51] mikecmpbll: why are your gems being installed to vendor/bundle?
[20:22:02] ratmav: great question!
[20:22:06] mikecmpbll: are you using the --deployment flag
[20:22:16] ratmav: no, i haven't had to use that before
[20:22:27] ratmav: let me get on the prod box and run that bundle show rails real quick
[20:23:34] mikecmpbll: in your project route, look for .bundle/config
[20:23:40] mikecmpbll: look at the contents
[20:24:05] mikecmpbll: on the prod server, obviously
[20:24:29] ratmav: checking.
[20:24:35] ratmav: they match
[20:25:13] _lazarevsky: im trying to start a new instance of rails server
[20:25:22] _lazarevsky: rails s -p 3001
[20:25:29] _lazarevsky: it says A server is already running
[20:25:35] _lazarevsky: the server that's running runs on port 3000
[20:25:39] ratmav: ah, the configs
[20:25:42] _lazarevsky: what am I missing here?
[20:26:17] mikecmpbll: _lazarevsky: are you on windows?
[20:26:19] ratmav: _lazarevsky, maybe that port is being used by something else?
[20:26:20] boombadaroomba: _lazarevsky: lsof -wni tcp:3000
[20:26:36] boombadaroomba: _lazarevsky: kill -9 PID
[20:26:45] boombadaroomba: _lazarevsky: where PID is the PID# in the column
[20:26:47] _lazarevsky: mikecmpbll: red hat linux
[20:26:52] ratmav: mikecmpbll, the configs match. i'm fairly sure that my setup is...not as clean as i need it to be.
[20:26:52] boombadaroomba: I am assuming you are in linux
[20:27:10] _lazarevsky: boombadaroomba: I am running a very computationally expensive process on the other server
[20:27:14] mikecmpbll: ratmav: sorry, you've lost me.
[20:27:16] ratmav: mikecmpbll, but still trying to sort out why my gems work in prod but not on this test box
[20:27:26] _lazarevsky: boombadaroomba: cannot allow to kil that process
[20:27:32] ratmav: mikecmpbll, no worries. configs for bundler match in prod and test
[20:27:35] _lazarevsky: boombadaroomba: I just need to run both in parallel
[20:27:55] boombadaroomba: _lazarevsky: then run it on another port
[20:28:19] _lazarevsky: boombadaroomba: I am trying but it keeps saying A server is already running
[20:28:29] _lazarevsky: tried different ports
[20:28:34] mikecmpbll: ratmav: not really relevant, i wanted to know what BUNDLE_PATH is configured.
[20:29:36] ratmav: vendor/bundle on both machiens
[20:29:50] mikecmpbll: and the output of bundle show rails was what?
[20:29:53] boombadaroomba: _lazarevsky: i am but a noob. Those are the methods I use when I encounter that error
[20:30:27] ratmav: prod: /var/www/v-am_rails/vendor/bundle/ruby/1.9.1/gems/rails-3.2.11
[20:30:49] ratmav: test: /var/www/v-am_rails/vendor/bundle/ruby/1.9.1/gems/rails-3.2.11
[20:30:57] ratmav: still the same
[20:31:02] ratmav: i did notice
[20:31:07] mikecmpbll: ok, so your bundle has installed fine
[20:31:25] ratmav: ls -rlasth /usr/local/bin/
[20:31:32] ratmav: in test: only bundler
[20:31:35] ratmav: in prod: all the gems
[20:31:47] ratmav: that's fairly confusing to me
[20:31:49] mikecmpbll: which one is the one that you're having a problem on?
[20:31:53] mikecmpbll: you've confused the fuck out of me.
[20:32:26] ratmav: mikecmpbll, sorry man. i tend to avoid asking questions until it gets really weird.
[20:32:50] boombadaroomba: ratmav: questions are weird. I mean, what area they?
[20:32:57] mikecmpbll: so on your test server, which rails is giving no output?
[20:33:04] ratmav: mikecmpbll, yes
[20:33:21] ratmav: in prod: /usr/local/bin/rails
[20:33:26] mikecmpbll: and on your test server, sudo which rails also gives no output?
[20:34:06] ratmav: of note: ruby is built from source on both boxes. however, test had rvm installed (rvm implode), but prod has not.
[20:34:38] ratmav: i did scrub rvm stuff from /.bashrc, etc.
[20:35:45] ratmav: boombadaroomba, for sure
[20:36:29] ratmav: boombadaroomba, i feel pretty bad when i ask and then find out it's in the manual. i try to avoid it when i can.
[20:37:09] ratmav: really, in general, getting a clean process down for installing from local gems in prod would be *really great*.
[20:37:23] ratmav: i thought bundle package, bundle install --local was the way to go
[20:38:48] crzrcn: How can I write a ActiveRecord query in the rails console, but not actually execute it, and just see the generated SQL?
[20:39:10] bricker: crzrcn: .to_sql
[20:39:38] momomomomo: +1 read the doc
[20:41:16] mikecmpbll: ratmav: coming to think of it, i see no reason why you'd get a rails binary in your $PATH by installing the gem that way
[20:41:41] ratmav: mikecmpbll, i agree that it's mysterious
[20:41:55] mikecmpbll: ratmav: bundle exec rails will probably work from within your project dir
[20:42:18] ratmav: mikecmpbll, you are correct
[20:42:34] mikecmpbll: if you want available on that server, then install it with rubygems.
[20:42:46] ratmav: but i don't have access to rubygems?
[20:43:10] ratmav: in reality, not on this box. in prod, not my network.
[20:43:21] ratmav: hospital it group.
[20:43:43] ratmav: not easy to open ports.
[20:44:07] ratmav: ah, someone asked me that earlier. not you. just recalled - sorry.
[20:44:13] ratmav: mikecmpbll, see above
[20:45:07] mikecmpbll: refresh my memory, in your vendor/cache are there a bunch of .gem files?
[20:46:16] mikecmpbll: then you ought to be able to CD into that directory and type gem install --force --local rails-4.0.0.gem
[20:46:22] mikecmpbll: or whatever the .gem file is called for rails
[20:48:16] ratmav: i'll give it a shot
[20:50:13] ratmav: mikecmpbll, took a sudo, but running
[20:50:20] mikecmpbll: ACTION shrugs.
[20:50:32] ratmav: mikecmpbll, me too. sudo freaks me out, but hey.
[20:50:54] mikecmpbll: well, installing a system gem will take sudo.
[20:50:58] mikecmpbll: so it's okay.
[20:51:38] ratmav: that's what i'm getting: building ruby from source and installing (sudo make install) is installing a new "system" ruby
[20:51:44] ratmav: so i have to install "system" gems.
[20:52:08] ratmav: well...that worked!
[20:52:10] ratmav: at least for rails
[20:52:39] ratmav: to get them all
[20:52:44] mikecmpbll: why do you want to do that
[20:53:00] ratmav: build from source?
[20:53:28] ratmav: why do i want to do what?
[20:53:33] mikecmpbll: "get them all"
[20:53:50] ratmav: stopped midway. communication failure on my end. bad packet man.
[20:54:35] ratmav: i'm running sudo gem install --force --local ./*.gem
[20:54:42] ratmav: that's what i meant by "get them all"
[20:55:10] ratmav: because sudo bundle install --local isn't working on this box for some reason?
[20:55:16] ratmav: which was the original issue?
[20:55:19] mikecmpbll: yes it is, your bundle is installed
[20:55:27] mikecmpbll: i don't even know that there was an issue originally
[20:55:35] ratmav: gems were not
[20:55:38] mikecmpbll: yes they were.
[20:56:00] ratmav: i need to run passenger -install-whatever module
[20:56:03] mikecmpbll: now you're installing all the gems of a project to your system
[20:56:09] mikecmpbll: for some reason
[20:56:22] ratmav: don't care. test box. as long as it can run for what I need, i can blow this thing away
[20:56:36] mikecmpbll: the point of the vendor/bundle install path is for isolation
[20:56:43] ratmav: i'm aware
[20:56:50] ratmav: bundle package
[20:56:57] ratmav: bundle install --local
[20:57:02] ratmav: that does what i need
[20:57:10] ratmav: some reason, not working so well on this test box
[20:57:25] ratmav: on prod box: which rails/which passenger work fine
[20:57:27] mikecmpbll: it was working fine though, with bundle exec
[20:57:34] ratmav: no, it wasn't
[20:57:39] mikecmpbll: what wasn't?
[20:57:42] ratmav: which rails
[20:57:51] mikecmpbll: that's not not bundle exec
[20:58:04] ratmav: ok, so on prod
[20:58:11] ratmav: i can which passenger
[20:58:15] ratmav: i get the path to passenger
[20:58:20] ratmav: on test box, nothing
[20:58:21] mikecmpbll: that's because you have passenger installed to your system
[20:58:25] ratmav: yep, i know.
[20:58:36] mikecmpbll: ok, so install passenger on you test machine?
[20:58:47] mikecmpbll: i'm just trying to get you to understand what's going on
[20:58:51] ratmav: that's what i'm doing with the gem install --force --local ./*.gem
[20:58:56] mikecmpbll: and that you don't need all your projects gems installed globally
[20:59:06] ratmav: yep. i'm hearing that.
[20:59:18] zorak8: when you are maing a page
[20:59:30] zorak8: you do the view or the model first?
[20:59:39] zorak8: (or the controller?)
[20:59:40] ratmav: zorak8, tests?
[20:59:56] mikecmpbll: zorak8: whichever you want.
[21:00:17] mikecmpbll: zorak8: you won't be able to get any data in to your view though without a model, controller, etc.
[21:00:33] zorak8: i was thinking tha the MVC was indeed order instrutions
[21:00:48] zorak8: first mae the model, then the view, then the controller
[21:00:51] ratmav: mikecmpbll, do you have an easier solution for using local gems?
[21:00:57] mikecmpbll: zorak8: nah.
[21:01:13] mikecmpbll: ratmav: i don't see what's wrong with your original process.
[21:01:45] ratmav: mikecmpbll, me either. originally was just here to figure out what was borked on the test box.
[21:01:52] zorak8: and im making a book (learn-rails) and i all the book ever do model, view, controller
[21:01:59] mikecmpbll: ratmav: and now you realise nothing was borked out, right? :d
[21:02:12] zorak8: and then at the end of the book, mae fisrt the view
[21:02:23] ratmav: mikecmpbll, no - couldn't find the gems i needed.
[21:02:30] skinofstars: hey guys. does rails or capistrano save the rails env to a file anywhere?
[21:02:31] ratmav: i had to run gem install --force --local
[21:02:38] ratmav: that's normally part of the process.
[21:02:39] mikecmpbll: ACTION gives up.
[21:03:20] ratmav: mikecmpbll, why would i have to run gem install --force on one box and not another?
[21:03:37] mikecmpbll: well, i don't know what you've done on your "prod" server, do i?
[21:03:49] ratmav: built ruby from source
[21:04:02] ratmav: ./configure, make, sudo make install
[21:04:12] ratmav: bundle package on localhost, scp tarball to prod
[21:04:21] ratmav: sudo gem install bundler on prod
[21:04:36] vmarcetic: hi, I want to remove a item from @items array how can I do that? With reject or @items.delete_if { |c| c.id == item.id }
[21:04:38] ratmav: sudo bundle install --local --without development test
[21:04:44] ratmav: pretty straighforward.
[21:05:03] ratmav: my *guess* is that having RVM on this box and then ripping it out broke some paths.
[21:05:30] ratmav: else not sure.
[21:05:31] mikecmpbll: if i provision a new server and deploy a rails app, install the bundle, ssh on to that server and type `which rails`, I'll get no output either.
[21:05:47] mosez: rvm sucks... real packaging rules :)
[21:06:22] ratmav: sudo bundle install --local --without development test typically does the trick for me
[21:06:28] mikecmpbll: okok, whatever
[21:06:55] ratmav: well, point it that it didn't this time (which pick_a_gem), and i was trying to figure out why
[21:07:07] mikecmpbll: yep, i explained exactly why already
[21:07:09] ratmav: i mean, short term fix is good (sudo gem install --force)
[21:07:11] mikecmpbll: but you don't believe me.
[21:07:25] ratmav: ok - please restate why it didn't work on the test box?
[21:07:59] mosez: opensuse/sles is the first distribution where i started to love the packaging of ruby and gems :)
[21:07:59] mikecmpbll: because you're bundle is installing to your BUNDLE_PATH, which is in your project
[21:08:03] mikecmpbll: rather than your GEM_HOME
[21:08:22] mosez: and my new apps are running without bundler and i will package my rails apps too :)
[21:08:50] mikecmpbll: because of your .bundle/config
[21:08:54] mikecmpbll: like i said about half an hour ago.
[21:09:13] nahtnam: Im finally getting the hang of Ruby on Rails! :)
[21:09:19] skinofstars: so, anyone know how I can find my RAILS_ENV from outside of rails? I'm trying to set up monit to manage some services
[21:09:29] ratmav: mikecmpbll, any idea why that wasn't an issue for me earlier?
[21:09:38] mikecmpbll: no idea, like i said i wasn't there when you did the other server
[21:09:48] mikecmpbll: any number of things could have happened, i'd be speculating
[21:10:01] ratmav: mikecmpbll, the only thing i can think of is that that file is in the repo when it wasn't before.
[21:10:13] mikecmpbll: that is very likely the case, yes.
[21:10:15] ratmav: i'll take a look at the git logs and see what's going on.
[21:10:30] ratmav: mikecmpbll, at any rate, i appreciate the heads up.
[21:10:54] mikecmpbll: if you use the --deployment or the --path flag for bundler, it will modify your b
[21:10:58] mikecmpbll: .bundle/config
[21:12:17] nahtnam: If I have two models (migrations), one called categories and the other called subcategories, do I have to "link" them together somehow?
[21:12:36] nahtnam: Maybe belongs to
[21:13:20] ratmav: mikecmpbll, found the problem. fuck up on my end. .bundle is in gitignore, but i have a .bundle in the directory i used to create the deployment tarball.
[21:13:41] ratmav: probably was monkeying around with it
[21:13:49] ratmav: that was frustrating.
[21:14:04] ratmav: my assumption was the deployment dir i had was clean.
[21:14:18] ratmav: i get why you would be frustrated. i would be too.
[21:14:42] mikecmpbll: i'm not frustrated.
[21:14:46] ratmav: thanks for hanging tough. take home for me on this is to just build that deployment from a fresh clone.
[21:15:01] ratmav: then i'm not assuming a working dir is clean
[21:15:07] mikecmpbll: the take-home is to try harder to understand the tools that you're using.
[21:15:17] zorak8: what are the task of an entry level/junior rails worker??
[21:15:22] ratmav: mikecmpbll, be fair.
[21:16:07] ratmav: i wrote off .bundle since i saw it in both places
[21:16:30] ratmav: let's not be too condescending.
[21:16:31] skinofstars: zorak8: i give mine specs to write :)
[21:16:48] mikecmpbll: i wasn't being condescending, that was genuine advice.
[21:16:58] mikecmpbll: and exactly what would help you in future.
[21:17:51] skinofstars: zorak8: what better way to learn a codebase than to test it?
[21:18:13] omosoj: Does this group by color "cheetah" and count them? Car.group(:color => "cheetah").count
[21:18:34] zorak8: and, after the test, reporting the bugs or solving the bugs?
[21:18:35] mikecmpbll: omosoj: !try
[21:19:24] omosoj: It fails a test. The error: NoMethodError: undefined method `to_sym' for {:color=>"cheetah"}:Hash
[21:19:28] skinofstars: zorak8: it's going to depend on the company. mine is very small, so thee junior gets to do a bit of everything, just with oversight
[21:20:10] mikecmpbll: omosoj: i assume you're calling to_sym on the result?
[21:20:51] mikecmpbll: yeah, dunno why i said that, didn't read the error properly.
[21:21:54] mikecmpbll: omosoj: that's not the correct syntax for group()
[21:22:22] omosoj: https://gist.github.com/josomo/11232877
[21:22:36] mikecmpbll: if you're just trying to count the number of Cars with color: "cheetah", just use Car.where(color: "cheetah").count
[21:22:40] mikecmpbll: you don't need to use group.
[21:23:05] omosoj: Yeah, but this exercise requires that I use it
[21:24:13] mikecmpbll: oh right, looks like you want Car.group(:color).count
[21:24:39] mikecmpbll: that's a really pointless exercise, you're just testing the framework.
[21:24:44] mikecmpbll: but oh well.
[21:25:47] omosoj: mikecmpbll, thanks, that passed the test.
[21:26:35] omosoj: Hmm. Would that work if there was more than 1 group of colors?
[21:26:59] omosoj: Car.group(:color) doesn't specify what color to group by.
[21:27:04] omosoj: (does it?)
[21:31:14] mikecmpbll: it returns a hash like { "cheetah" => 5, "somethign else" => 7}
[21:31:36] mikecmpbll: that's why you're calling color_group["cheetah"] to get the count of only "cheetah" color
[21:32:15] GeekOnCoffee: everyone stop what you???re doing and read slides: https://speakerdeck.com/carlosantoniodasilva/tricks-that-rails-didnt-tell-you-about-at-railsconf-2014
[21:32:53] vmarcetic: can anyone tell me how to remove specific item from @items array
[21:33:09] GeekOnCoffee: vmarcetic: reject
[21:33:22] vmarcetic: doesn't work and delete_if also
[21:33:33] vmarcetic: i have this
[21:33:34] vmarcetic: @items.delete_if { |c| c.id == item.id }
[21:34:31] mikecmpbll: vmarcetic: it does work, i think someone would have noticed if it didn't work.
[21:37:00] mikecmpbll: GeekOnCoffee: bookmarked that for the mornin', looks good.
[21:37:01] skinofstars: what cruel person would create a 150 slide presentation?!
[21:37:37] vmarcetic: I still have item in @items
[21:37:49] joelbrewer: GeekOnCoffee: I was at that talk :)
[21:38:01] mikecmpbll: vmarcetic: you're going to have to show some code and output if you want some help.
[21:46:20] Etriaph: G'day folks.
[21:50:06] Shackleford: Is this the correct way to include JSON to a controller in rails 3.2 https://gist.github.com/anonymous/8e386955178a9378fc50
[21:50:09] agent_white: Good afternoon
[21:51:05] mikecmpbll: Shackleford: looks alright to me
[21:51:08] mikecmpbll: does it work? :)
[21:51:32] Shackleford: it does, but I was just curious if it is different in rails 4
[21:51:40] mikecmpbll: nope, not that i know of.
[21:53:13] Shackleford: I have also seen this format https://gist.github.com/anonymous/cc29249b2caad55de17f
[21:53:45] Shackleford: And I am trying to understand the difference between the two, specifically how it is handled in the action method
[21:55:06] Etriaph: I have a logistical obstacle to overcome, wondering if I can get some advice. I need to generate a PDF that will only be accessible for download the user who owns it, so I need to 1) figure out where to save the PDF inside my rails application and 2) how to restrict access only to the user who generated it
[21:55:54] Etriaph: I'm using prawn to generate the PDF
[21:56:23] Etriaph: I don't necessarily want to stream the PDF to the user either as I'd like them to save PDFs they generated in the past.
[21:58:43] mikecmpbll: Shackleford: the respond_to style allows you to do different stuff in the controller based upon format
[22:00:18] mikecmpbll: Shackleford: probably best explained by Jose Valim: http://blog.plataformatec.com.br/2009/08/embracing-rest-with-mind-body-and-soul/
[22:01:31] mikecmpbll: Etriaph: what are you stuck with? sounds quite straight forward :)
[22:02:00] Etriaph: mikecmpbll: Well, I haven't done this yet with Rails and I'm 1.5 months old with the framework :)
[22:02:30] mikecmpbll: Etriaph: ah okay. well, you'll want a model for your PDFs, then probably use paperclip (gem) to associate the files to the model
[22:02:53] mikecmpbll: user has_many :pdfs or however you like.
[22:03:08] Etriaph: Let me take a look at paperclip..
[22:07:45] Etriaph: mikecmpbll: Not quite what I was thinking, I think paperclip is overkill for me.
[22:07:55] mikecmpbll: Etriaph: why? :)
[22:08:06] Etriaph: The user will not be uploading a file, I'll be creating it and enabling download.
[22:08:50] mikecmpbll: that's irrelevant as far as paperclip is concerned.
[22:09:07] Etriaph: Paperclip also seems to be focused on storage using fog
[22:09:37] V9Energy: guys, how can i make jbuilder output the object like this: [{1: { 'name':'bob' }, 2: { 'name':'jon' }, }] instead of [{ 'id':'1', 'name':'bob'}.....etc
[22:09:55] mikecmpbll: considering i use paperclip and i don't even know what fog is, i find that statement unlikely.
[22:10:31] Etriaph: https://github.com/thoughtbot/paperclip#defaults is what I'm looking at at the moment
[22:10:44] mikecmpbll: riight, that's just an example of how you can change the storage defaults
[22:10:54] mikecmpbll: they've clearly used "fog" whatever that is, as an example.
[22:11:17] Etriaph: Ah, fog is something I ran into, manages storage on remote storage services, ie. Rackspace or S3
[22:11:31] mikecmpbll: ok, so there we go, it's an example because it's probably a common use case.
[22:11:39] Etriaph: ACTION nods
[22:11:43] Etriaph: OK, I'll give it a shot.
[22:11:47] mikecmpbll: i wasn't saying you have to use paperclip anyway, was just suggesting it.
[22:12:06] mikecmpbll: you can manage storing files yourself, but what's the point
[22:12:48] Etriaph: Where, by default, does paperclip store the files?
[22:12:56] Etriaph: Just out of curiosity
[22:14:27] doubleemms: anybody know why using the :limit and :offset options in a Model.find would include an extra key in each record called `__rn: n`, where n is the result number?
[22:14:39] doubleemms: or, more precisely, how to stop it from doing so?
[22:15:25] mikecmpbll: Etriaph: public/system or something, can't remember off top of my head
[22:15:27] lbwski: Paperclip will store on the local filesystem in the path you provide (probably something in public/) by default. Using S3 or another store is optional
[22:16:26] mikecmpbll: actually, i think the default is public/system/:model/:attribute
[22:16:47] lbwski: yea, i think you're right
[22:17:16] mikecmpbll: so if you have a paperclip attachment :profile_pic on User, it'll be public/system/users/profile_pics/
[22:18:58] Etriaph: OK, so if I'm creating the file myself, how do I associate it with the attribute in the model?
[22:19:09] Etriaph: Prawn will want to write the file to disk
[22:20:06] Etriaph: Prawn::Document.generate(filename,options={},&block)
[22:21:41] Etriaph: Oh, Prawn has Prawn::document.render() which renders to a String
[22:22:09] mikecmpbll: was just looking for something like that, you beat me to it.
[22:22:35] Etriaph: So could I do Report.pdf = Prawn::Docuent.render() ?
[22:24:34] Etriaph: One sec, baby on the loose
[22:27:24] mdpatrick: I'm having a bizarre issue where when I first start my rails app locally using the built-in webserver I have to click refresh several times to get past some failed to autoload constant errors
[22:29:49] momomomomo: argh nutch you kill me
[22:39:40] t4nkd: Hey rails, um, I've never seen anything like this, but, for some reason a few moments after I start my rails app, something starts making HEAD "/" requests, and then for some reason migrations kick off and the web server gets stuck in a BEGIN ROLLBACK loop -- this is really, really weird: https://gist.github.com/jonpaul/4a7875bc38c21f3bb102
[22:40:41] t4nkd: Just wondering if anyone could explain why this is happening, there's nothing obvious in the code base that I can tell, but I did upgrade form 4.0.iforgot to 4.1 -- kinda about to create a new project from scratch...
[22:41:52] dfr|railsconf: t4nkd, it looks that there're logs interleaving going on. Are you running it multithreaded?
[22:42:11] dfr|railsconf: t4nkd, and you're firing off concurrent requests too?
[22:42:26] t4nkd: No, that's the weird part, this just happens :(
[22:42:40] t4nkd: I don't even have to make a single request, I just start the web server and be patient
[22:43:31] dfr|railsconf: t4nkd, what if you start it on a different port? And you start it all locally?
[22:43:50] t4nkd: Haven't tried locally, but I've tried different forwarded ports(using vagrant w/ osx)
[22:44:12] dfr|railsconf: t4nkd, if you're using some managed service, maybe it's trying to check whether your service is alive and well?
[22:44:16] dfr|railsconf: that's the only thing I can think of
[22:44:38] Etriaph: Getting this when running rake db:migrate : Gem::LoadError: You have already activated rake 10.3.1, but your Gemfile requires rake 10.2.2. Prepending `bundle exec` to your command may solve this.
[22:44:46] t4nkd: Yeah that's what I figured, I have two other projects in a little microserverices architecture and this is the only project it happens to
[22:45:13] t4nkd: It was a long shot that someone would go, "Oh, I remember that issue" but I figured I would try :)
[22:45:14] Scient: MicroSOABigRails!
[22:45:27] Scient: theme of the day :)
[22:45:41] dfr|railsconf: Scient, are you at rails conf
[22:46:06] t4nkd: heh, I've been dying to write an SOA in rails/angular for like two years :P
[22:46:15] dfr|railsconf: t4nkd, but yea, that looks scary. Debug debug! and tell us what it was
[22:46:29] dfr|railsconf: Scient, did I ever met you face to face? and if not, why are you not at bohconf saying hi yet?
[22:46:38] t4nkd: It *might* be something like new-relic
[22:46:48] Scient: No and whats bohconf
[22:47:02] Scient: What have i missed :)
[22:47:47] dfr|railsconf: Scient, it's a coding unconference at railsconf. This year ninefold guys are sponsoring a room which is technically bohconf, but I think they're a bit confused about its existence ;)
[22:47:54] dfr|railsconf: Scient, anyhow, it's on the lower level, Ontario room.
[22:48:04] dfr|railsconf: Scient, I'm here since I'm too cheap to pay for sessions of the real conference
[22:48:32] Scient: So you just hang out there?
[22:48:49] Scient: Wait, where did you work again?
[22:48:51] RubyRonin: greetings all
[22:49:13] RubyRonin: Does anyone have a proposal template for developing a membership web application?
[22:49:21] dfr|railsconf: Scient, Google >.<
[22:49:33] dfr|railsconf: Scient, and yes, I do. I'm refactoring jruby's loadservice, mostly
[22:50:21] t4nkd: How's refactoring jruby for google :D?
[22:50:51] dfr|railsconf: t4nkd, I didn't parse that.
[22:51:16] dfr|railsconf: Scient, on a more serious note, it's just that I don't get much out of the sessions for the last few years, so no point in paying for it.
[22:51:23] t4nkd: How do you feel about working for google in the context of rewriting jruby
[22:51:25] dfr|railsconf: Scient, but I do like to meet and hang out with people.
[22:51:51] dfr|railsconf: t4nkd, working for google by itself is good. Ruby at google is pretty much non-existent. But I try against any odds. :)
[22:52:33] dfr|railsconf: t4nkd, I do have a rails app originally written in 2006 that I maintain that we deploy on an http servlet container. :)
[22:52:41] t4nkd: heh, yeah I figured asking how google is would be kind of a silly question, though I had imagined that ruby was almost nonexistant there
[22:53:12] t4nkd: Ooo that sounds... well, kinda cool anyway, at least they haven't killed it, I mean, rails stacks from 2006... but otherwise :D
[22:54:07] dfr|railsconf: t4nkd, supporting multiple internal languages is kind of expensive. :)
[22:54:45] t4nkd: Yeah, I have been picking up on that fact... slowly...
[22:54:59] davidcelis: t4nkd: you're writing a new relic?
[22:55:31] t4nkd: I'm writing... um... a bunch of services, like, literally, to help Malwarebytes kick more ass
[22:56:05] jpstokes: just install rvm and vim and rails.vim fresh install of everything, but when I run :Rake it's saying that my ruby version doesn't match
[22:56:20] jpstokes: it works fine when I run from the console...any ideas?
[22:56:41] t4nkd: vim or macvim? bash or...?
[22:57:28] jpstokes: error log: https://gist.github.com/jpstokes/5926037913b5a5237e8f
[22:58:11] Etriaph: mikecmpbll: Got it working with a bit of hackin' :)
[22:58:19] jpstokes: to me looks like it looking at the system ruby when it should be looking at the rvm version
[22:58:27] mikecmpbll: Etriaph: great!
[22:58:42] Etriaph: Had to do report.pdf = StringIO.new(pdf.render())
[22:58:52] t4nkd: jpstokes: https://rvm.io/integration/vim
[22:59:10] t4nkd: Though iirc it's slightly more complicated than that because you have zsh
[22:59:39] t4nkd: But yeah you're pretty much right, RVM isn't hooking in between whatever shell your vim is calling to
[23:01:16] t4nkd: I never had a lot of luck integrating rake with vim, especially w/ zsh+rvm, things were a PITA
[23:01:37] Etriaph: mikecmpbll: Now a good question, how do I get a URL to that file?
[23:02:14] walidvb: hey guys, I just moved my paperclip attachment from S3 to :filesystem, and I can't figure out how to read that file..
[23:02:20] mikecmpbll: what model did you end up using paperclip with?
[23:04:00] Etriaph: The report record represents a single report.
[23:04:27] Etriaph: And each report is a PDF
[23:04:30] Etriaph: Pretty simple
[23:05:03] mikecmpbll: gotcha, so you can use resourceful routing of report
[23:05:11] mikecmpbll: and have a show action that renders the pdf attachment
[23:05:54] walidvb: i keep getting a No such file or directory @ rb_sysopen error, even though the file is there, in the url shown
[23:06:07] walidvb: I'm trying to use File.read, should I go withsmth else?
[23:06:29] mikecmpbll: Etriaph: you can use send_file from the show action.
[23:06:39] Etriaph: send_file(report.pdf)?
[23:06:44] walidvb: nice. i'm trying to sen a file too ^^
[23:06:52] t4nkd: It needs to at least be an absolute file path...
[23:06:58] davidcelis: walidvb: Can't you use the built-in Paperclip helpers?
[23:07:01] mikecmpbll: send_file(@report.pdf.path) i think
[23:07:10] Etriaph: OK, let me try that
[23:07:10] walidvb: davidcelis: hm
[23:07:11] davidcelis: walidvb: https://github.com/thoughtbot/paperclip#usage
[23:07:13] t4nkd: http://apidock.com/rails/ActionController/DataStreaming/send_file
[23:07:59] davidcelis: ah the file_name probably wouldn't include the path
[23:08:00] t4nkd: I assume Etriaph is not using carrierwave/paperclip because of StringIO :P
[23:08:20] walidvb: davidcelis: i need to read its content
[23:08:33] davidcelis: walidvb: Got a gist?
[23:08:53] mikecmpbll: yeah he's using paperclip. seems you need to be a little hacky to add prawn pdf as an attachment
[23:09:32] t4nkd: Yeah, in fact iirc I had to monkeypatch StringIO because it didn't mesh well... can't recall why
[23:09:32] Etriaph: t4nkd: I used StringIO to construct a file-like interface for Prawn
[23:09:35] Etriaph: Worked like a charm
[23:09:51] t4nkd: Oh, yeah, that works fine, I had an issue saving a StringIO without putting it on disk iirc
[23:09:54] Etriaph: Prawn either writes to disk or renders to a string
[23:10:11] walidvb: davidcelis: https://gist.github.com/walidvb/11235711
[23:10:22] t4nkd: Well I mean, taking an object with an uploader and giving it a StrinIO insted of a UploadedFile or whtever that Dispatcher class is
[23:10:43] Etriaph: mikecmpbll: Because there was no phsyical file, when I assigned StringIO.new(pdf.render()) the filename defaulted to 'data'
[23:10:59] t4nkd: StringIO doesn't have original_filename attribute iirc, had to monkeypatch that in...
[23:11:01] Etriaph: Do you know what member of Report.pdf would allow me to set the filename before it writes?
[23:11:04] t4nkd: Anyway....
[23:11:15] mikecmpbll: Etriaph: ah, what t4nkd said I guess.
[23:11:24] walidvb: davidcelis: https://gist.github.com/anonymous/6ba0d89e9e616d289880 and my defaults
[23:11:28] t4nkd: StringIO isn't "on disk" though, not really
[23:11:41] Etriaph: But it's the only bypass I have at the moment
[23:11:54] davidcelis: Is :filesystem actually the right optoin?
[23:11:58] davidcelis: I thought it was :file
[23:12:06] walidvb: davidcelis: hm it does store the file
[23:12:11] Etriaph: Representing a file in memory isn't really my desired solution for this, but..
[23:12:16] davidcelis: ah it is filesystem
[23:12:27] Etriaph: Paperclip has made it come together quickly, no complaints :)
[23:12:27] mikecmpbll: what's the class of a file parameter when it comes in via upload anywho?
[23:12:30] davidcelis: walidvb: So it's going to /public/system/ ?
[23:12:35] t4nkd: Sorry I'm like, jumping into the middle of your problem talking about another problem I had with StringIO and trying to save to a carrierwave uploader...
[23:12:38] mikecmpbll: i'm surprised you can't mock that better than using stringio.
[23:12:40] Etriaph: attachment_filename maybe?
[23:12:43] walidvb: davidcelis: it is, going right there
[23:12:50] t4nkd: Yeah paperclip should have a method for the file path...
[23:13:05] davidcelis: walidvb: What's the code you're trying to actually run? The call to File.read
[23:13:06] Etriaph: Let me use irb, it'll help me find my methods
[23:13:33] walidvb: well, as you see on the line above, I used to have that in S3, but moving to local now
[23:13:46] walidvb: i need to read that file to be able to later attach it to a mail
[23:13:54] mikecmpbll: http://apidock.com/rails/ActiveSupport/XmlMini/FileLike apparently
[23:15:55] Etriaph: mikecmpbll: Model.attribute_file_name so report.pdf_file_name
[23:16:16] davidcelis: walidvb: Yeah but I don't know how you're actually trying to read the file...
[23:16:22] mikecmpbll: ah yeah, so you could just modify that.
[23:16:24] t4nkd: report.pft_file_path ?
[23:16:34] walidvb: davidcelis: hm I don't know either ^^
[23:16:43] davidcelis: walidvb: You said you were trying File.read
[23:16:53] davidcelis: So what's the exact File.read call you tried?
[23:16:59] walidvb: davidcelis: yes, but might not be the right way
[23:17:09] t4nkd: Or even just, Model.attachment_class.path tbh
[23:17:18] walidvb: i know that i used this open(file.url) { |f| @content = f.read}
[23:17:35] t4nkd: Or, rather, Model.attachment_association_getter... w/e
[23:17:39] walidvb: and that worked, so i assumed I would do the same, only locally. i'm wrong, apparently
[23:17:57] walidvb: the goal is to attach that file to an ActionMailer
[23:18:14] davidcelis: walidvb: What exactly does file.url return?
[23:18:24] t4nkd: Etriaph: Try Class.pdf.path -- that should be the absolute path to the file
[23:18:36] walidvb: davidcelis: it returned the http:// url of the file
[23:18:48] davidcelis: yeah you just want the file path since it's local.
[23:18:56] walidvb: when it was stored on S3 now
[23:19:01] axilaris: hi, im curious in asset pipeline, when i include a gem like chartkicks or bootstrap
[23:19:02] davidcelis: You really just want to do @contents = File.read(path_to_file)
[23:19:08] walidvb: now it's stored locally
[23:19:08] axilaris: where are the .js files located ?
[23:19:22] Etriaph: t4nkd: Well I wanted to change the name before I saved it to disk so the user who downloads it doesn't see a file named "data" :)
[23:19:25] t4nkd: axilaris: wherever the gem is installed to, which can vary
[23:19:28] Etriaph: I have it working right now.
[23:19:28] axilaris: those that are in the gem
[23:19:29] walidvb: davidcelis: No such file or directory @ rb_sysopen - /Users/Gaston/dev/pigeonhole/pigeonhole/public/system/chapters/files/000/000/001/original/Account_Settings_Page.jpg
[23:19:39] axilaris: not the ones i copy into the asset folder
[23:19:47] t4nkd: axilaris: that's... not a gem
[23:19:47] walidvb: davidcelis: that file _is_ there
[23:19:55] davidcelis: walidvb: try File.open(file.path)
[23:20:06] axilaris: say i do gem 'chartkicks', where is chartkicks js fle located ?
[23:20:11] axilaris: is there a way to find out ?
[23:20:22] Etriaph: Thaks for the suggestion and help mikecmpbll and t4nkd :)
[23:20:29] Etriaph: Time to smoke.
[23:20:29] walidvb: davidcelis: same.. i don't need to restart the server, right?
[23:20:32] t4nkd: axilaris: https://github.com/ankane/chartkick/blob/master/app/assets/javascripts/chartkick.js right there
[23:20:36] davidcelis: walidvb: I don't think so. You could try
[23:20:58] axilaris: t4nkd: thx, how about in my local machine ?
[23:21:22] t4nkd: axilaris: where ever you installed the gem, which varies based on rbenv vs rvm(or none of the above) and how you use bundler
[23:21:57] walidvb: davidcelis: nope
[23:22:08] axilaris: t4nkd: thats something i am not sure. i have rvm, usually i use brew, a gem install xxx
[23:22:12] mikecmpbll: Etriaph: no probs.
[23:22:22] t4nkd: great, how about rvm info, where does it say your GEM_PATH is
[23:22:56] axilaris: im trying gem query --local
[23:23:35] t4nkd: Sorry, are you saying you're not sure the gem is installed? Or are you asking where it might be on your disk?
[23:25:21] walidvb: hmm.. i might just switch back to S3... a shame, though, all I wanted was read the contents of that file locally
[23:25:30] t4nkd: It might not mean anything to you, but you should not modify gems on your disk, for a number of reasons
[23:25:35] t4nkd: just as an asside
[23:26:06] t4nkd: walidvb: the file exists locally before they are on S3 if you're using something like carrierwave
[23:26:36] walidvb: hm that, i don't know. but the other web hosted files are not there.
[23:26:51] walidvb: t4nkd: oh, and i'm trying to stop usin gS3 actually for this attachment
[23:27:47] t4nkd: Sorry, I'm not sure what you mean by 'other web hosted files are not there', but, using different storage for different attachments(which I assume are their own class in uploaders/) is easy enough
[23:30:11] walidvb: t4nkd: well, te storage works, but i'm trying to read the contents of that file, and it tells me it can't find it.
[23:30:16] walidvb: which is what confuses me.
[23:30:59] t4nkd: What is the storage_path of the uploader class?
[23:31:06] t4nkd: It's an instance method...
[23:31:44] walidvb: t4nkd: did you see the gist?
[23:32:08] lethjakman: anyone know of a way to speed up activemailer?
[23:32:13] lethjakman: it's obviously backgrounded
[23:32:31] lethjakman: but it still seems to take a long time per email
[23:32:43] t4nkd: sorry, er, store_path I believe...
[23:32:43] t4nkd: It'll be Rails.root/uploader by default iirc, is it actually on disk?
[23:33:36] walidvb: t4nkd: well, the path it is telling it doesn't find exist.
[23:33:46] walidvb: it's in public/system/...
[23:34:01] t4nkd: Is the file actually there...?
[23:35:14] t4nkd: I'm pretty much going to ask you to check Whatever.attachment.current_path next and see if that matches where you see a file on disk
[23:35:21] t4nkd: Becuase I'm super interested if it is
[23:35:39] walidvb: t4nkd: it is
[23:35:55] t4nkd: And File.exists?(Model.attachment.current_path) is false?
[23:35:58] walidvb: No such file or directory @ rb_sysopen - /Users/Gaston/dev/pigeonhole/pigeonhole/public/system/chapters/files/000/000/001/original/Account_Settings_Page.jpg?1398264468
[23:36:22] walidvb: wait, i'm noob. 2 secs. that path i just posted exists on disk(not via ruby, yet)
[23:38:01] walidvb: t4nkd: so i put a binding.pry in that function
[23:38:13] walidvb: the model is chapter, the attribute is 'file'
[23:38:37] walidvb: self.file is a Paperclip::Attachment, but file.current_path is undefined method
[23:38:55] t4nkd: Oh my bad, I thought we were using carrierwave
[23:38:59] walidvb: file.url, though, is /system/chapters/files/000/000/001/original/Account_Settings_Page.jpg
[23:39:02] t4nkd: w/ paperclip it's just 'file.path'
[23:40:37] walidvb: that has lead me to the next error ;)
[23:40:41] walidvb: take one down...
[23:40:46] t4nkd: horray :D
[23:40:48] walidvb: and thanks davidcelis
[23:41:43] walidvb: t4nkd: and next error down too hooray indeed!
[23:42:16] t4nkd: :D next step is profit
[23:42:24] zorak8: how can i make a Image_tag centered?
[23:42:28] walidvb: many next steps before profit ;)
[23:43:09] t4nkd: zorak8: depends on the styling of your parent elements
[23:43:29] t4nkd: zorak8: but there's vertical-align:middle; margin:0 auto; if you're lucky
[23:43:42] t4nkd: those are CSS styles btw and have shit all to do with image_tag
[23:48:25] zorak8: t4nkd: <%= image_tag "portada.jpg"vertical-aling:middle; margin:0; auto %>
[23:49:00] t4nkd: <%= image_tag "portada.jpg", style: "vertical-align:middle; margin:0 auto;" %>
[23:49:59] rsl: inline style ftl
[23:50:17] rsl: <%= image_tag "portada.jpg", class: "whatever" %>
[23:52:47] t4nkd: rsl: I'm not gonna bother, tbh
[23:52:55] t4nkd: You can explain it to him though :)
[23:53:05] rsl: what do you mean?
[23:53:39] t4nkd: If you want him to do it "the right way"
[23:53:39] rsl: teach him how to use css instead of inline styles? ;)
[23:53:49] t4nkd: Yeah or just that bit, either one
[23:54:08] rsl: i like the sarcastic air quotes around "right way"
[23:54:15] rsl: like inline css is REALLY the right way. whatever.
[23:54:41] t4nkd: Err... not what I meant with the quotes
[23:54:47] diegoviola: how do i tell my client that i will be increasing my hourly rate without offending him?
[23:55:10] recurrence: is there a select tag that lets me change the param key for the field before it gets to the backend?
[23:55:56] recurrence: eg: f.select :stuff_id as :thing_id, Stuff.order().map{}...
[23:56:20] zorak8: rsl where i can found the options of class??
[23:56:38] t4nkd: recurrence: you can use a regular select_tag...
[23:56:47] rsl: zorak8: have you bothered reading any rails guides or the api?
[23:57:23] zorak8: rsl, omg, rails guides or the API, how i dont think in that?!