« Back to channel list

#RubyOnRails - 19 June 2013

« Back 1 day Forward 1 day »
[00:00:39] jeebster: is it possible to persist a variable at the application controller level between requests?
[00:00:51] jeebster: class or global perhaps?
[00:01:02] rushed: jeebster: session, database
[00:01:38] jeebster: rushed: session is client side though no? I need server side, guess it'd have to be db if that's the case
[00:01:50] jeebster: trying to pull of some sort of a/b functionality
[00:02:31] ryan_turner: Hi, so I have 2 method objects; one is new, the other is one that I found from a db. I'm trying to use the new one to overwrite values on the old one. Of course, since it's an object, I can't simply do oldobject.update_attributes(newobject). Even if I do .attributes it wont work of course since I dont have hash with symbol keys but instead strings. So, I figured I'd just take the ID of the old and set that as id of new and do save, b
[00:02:31] ryan_turner: ut the trouble is that active record tries insert instead of update.
[00:02:51] rushed: jeebster: you might find these useful https://www.ruby-toolbox.com/categories/A_B_Testing http://railscasts.com/episodes/331-a-b-testing-with-split http://railscasts.com/episodes/214-a-b-testing-with-a-bingo
[00:02:57] ryan_turner: So, how can I update an object's attributes using another object besides manually setting each attribute?
[00:03:14] jeebster: rushed: yeah I've seen those, just trying to minimize the footprint if possible. thanks though
[00:03:56] rushed: jeebster: well that's a wide assortment of source code that solves the problem you're interested it, perhaps you could take a peek at where they store data :)
[00:04:31] jeebster: yup, I'll be doing that
[00:04:37] ryan_turner: rushed, ideas for me? :)
[00:04:57] rushed: ryan_turner: I would re-evaluate your "wont work of course" :)
[00:05:06] ryan_turner: Eh? Hang on...
[00:05:37] passbe: How can execute another action in the same controller from an action that doesn't change the URL, ie without using redirect_to, is that even possible?
[00:05:57] rushed: passbe: move the code somewhere and call it from both places?
[00:05:59] ryan_turner: I did .attributes on the old object instead of the new object :)
[00:06:29] ryan_turner: rushed, hmmm, what about handling created_at and updated_at... Can't mass-assign protected attributes: created_at, updated_at
[00:06:44] slash_nick: thing.created_at = 3.days.ago
[00:06:58] ryan_turner: guess I want to delete both since the update should take care of them?
[00:07:03] rushed: ryan_turner: why are you moving the data to a new object if you want everything the same?
[00:07:20] ryan_turner: rushed, syncing API data with DB data
[00:07:43] ryan_turner: So pulling API data in, throwing it in an object, then using that to update the DB object that corresponds.
[00:08:13] ryan_turner: I can't just throw the ID of the old row on it and do .save, it makes an insert instead of an update
[00:08:30] ryan_turner: of the old row on the new object **
[00:13:11] rushed: ryan_turner: are you intending for your local tables primary key to match the IDs provided by the API?
[00:13:32] ryan_turner: No, which is what makes this a bit more complicated.
[00:37:54] aamax: weird. my wife just loaded the page for my website i'm building - she's using IE of course, can't seem to break her of it - and after a few seconds key words on the page start to turn into links that go to 3rd party sites. WTF?
[00:38:23] rhizome: aamax: infected
[00:40:58] Fire-Dragon-DoL: rhizome: ie or website? :P
[00:42:03] aamax: hmmm the site is on heroku. it's the rails site i've been working on. how would THAT be infected?
[00:42:20] aamax: and it's possible her laptop is. she doesn't know much about keeping out of trouble.
[00:42:27] rhizome: the browser is infected
[00:42:28] aamax: shit. that's all i need
[00:42:41] Fire-Dragon-DoL: "consequences of using IE"
[00:42:49] Fire-Dragon-DoL: show her it now xD
[00:43:01] aamax: Fire-Dragon-DoL, ?
[00:43:38] Fire-Dragon-DoL: try to explain what happens if she uses ie, showing what already happened
[00:44:12] rhizome: google "ie hijack" plenty of info
[00:44:25] aamax: rhizome, k. thx.
[00:45:55] ner0x: Is there a typical set of options for t.decimal when you're doing currency?
[00:46:10] ner0x: t.decimal :price, scale: 2, precision: 10 is what I've been using since I saw it somewhere.
[00:46:29] rhizome: that sounds familiar
[00:50:30] ner0x: Seems precision: 8 is standard.
[00:50:31] ner0x: That works.
[00:50:33] ner0x: Thanks. :)
[00:53:57] aamax: wow, seems she wasn't using IE. they are showing up in Chrome!
[00:57:26] GreekFreak: I am trying to deploy using capistrano, and when I run deploy:setup it says I do not have permissions to create the folders. However, when I ssh into the server with that user and create a folder, it creates it successfully. Any ideas?
[00:58:33] rhizome: GreekFreak: what user owns the parent directory?
[01:01:53] GreekFreak: rhizome, I have run "chown -R username /home/username" and I have 'set :deploy_to, "/home/username/apps/myapp"'
[01:02:17] Shorty_: Hey guys, I'm trying to make a 'bootstrap' of sorts for some of our internal rails apps. we're often using the same gems, layout files and sharing a few models.. is there any easy way for us to achieve that?
[01:02:46] ner0x: Now if I have a t.integer :created_by column and I want it to be updated with the current users ID that's logged in. is there a way to do that with an before_create callback and the global variables? I'm not sure what's accessible via the model that lives in the outside world.
[01:05:56] w32stuxnet: hi guys, I am getting the error "undefined method `to_sym` for nil:NilClass when running the following test case: https://gist.github.com/anonymous/17064a07447b0f382d93
[01:06:01] w32stuxnet: The error occurs on the line visit root_path
[01:06:07] w32stuxnet: I have debugged, and root_path returns "/"
[01:14:30] tfitts: can someone tell me what I'm supposed to do to switch from bundler 1.0.15 to 1.3.5? I ran gem install bundler and it installed 1.3.5 but then I run bundle --version in my app it still shows 1.0.15
[01:14:31] butblack: does anyone have experience with heroku? I made a small app, my post and get requests and put requests complete with a 200 or 302 response, however my put requests only update minutes later, sometimes more than 20 mins later
[01:14:52] butblack: i don't have the same issue with my get and post requests, they are immediately updated
[01:16:22] GreekFreak: tfitts, bundler is not in your apps gemset. it's in your global gemset. Are you using RVM?
[01:17:41] rhizome: GreekFreak: does that user own /home/user/apps, too?
[01:20:51] GreekFreak: rhizome, /home/user/apps did not exist and neither did /home/user/apps/myapp. So I created them, and still nothing. That user does indeed own all of them.
[01:21:21] rhizome: paste the log of cap deploy:check
[01:21:34] rhizome: also #capistrano might be helpful
[01:22:20] GreekFreak: tfitts, in RVM I would "use @global" in order to use the global gemset, and then run bundle update in there. maybe there's a similar thing you could do
[01:22:45] GreekFreak: rhizome, I'll run that now. I thought I was only supposed to run deploy:check after I ran deploy:setup
[01:23:07] rhizome: nah, check can be run at any time to see if everything's kosher
[01:24:02] rhizome: gr, stupid baiduspider
[01:24:16] GreekFreak: rhizome, it says 'myapp/releases' does not exist. Please run `cap deploy:setup'
[01:24:55] rhizome: and just to be sure, perms are something like 755, right?
[01:25:35] rhizome: and gist the log of setup
[01:26:26] GreekFreak: rhizome, they are 777. gisting now
[01:26:38] rhizome: no, not 777! 755 max
[01:26:46] tfitts: GreekFreak: thanks, that pointed me in the right direction
[01:26:56] rhizome: some utils will fail out at global-writable dirs, cap may be one
[01:27:35] GreekFreak: rhizome, https://gist.github.com/tscholiadis/5811015
[01:28:00] GreekFreak: rhizome, what do you mean by "global-writable" ?
[01:28:06] GreekFreak: tfitts, glad I could help
[01:28:25] rhizome: GreekFreak: world-writeable ******rwx
[01:28:45] rhizome: GreekFreak: your deploydir is wrong, it's trying to create /home/appname
[01:29:53] GreekFreak: rhizome, it's correct. my appname and username are the same. My app should be in /home/bluverve_demo/apps/bluverve_demo
[01:30:47] GreekFreak: rhizome, I ran "chown -R" based on Rails in Action book that I read. should I change the permissions to 755? they are this at the moment: drwxrwxr-x
[01:31:01] banas: Can someone please tell me what a factory is?
[01:31:17] banas: I'm a n00bie.
[01:32:22] GreekFreak: banas, a factory is a "function" that can mass create data for you
[01:33:00] banas: Thanks for replying GreekFreak! Could you please elaborate? :)
[01:33:21] GreekFreak: banas, if for example you want to create lots of entries in your DB of a specific model, then you use a factory to create 100 of them instead of entering them one by one
[01:33:23] banas: mass data as in that conforms to a set of rules I specify?
[01:33:49] rhizome: GreekFreak: it shouldn't be trying to create the user dir
[01:34:40] banas: So if I somehow tell the factory that emails look like something@something.com, it will generate possible emails that follow the same rule - is that right, GreekFreak ?
[01:35:09] sevenseacat: see: factory_girl, the main tool in rails to generate factory data
[01:35:20] rhizome: banas: what kind of factory are you talking about? there's a FactoryGirl factory and there's an OOP factory
[01:35:29] GreekFreak: banas, technically, you can create "lots of anything". Its more practical use in rails is what I just showed you. If you read this (http://ruby.railstutorial.org/ruby-on-rails-tutorial-book?version=3.2) it explains it in detail in one chapter. also it's a good book for noobs. I started there
[01:35:38] banas: Factory girl. That's the one I found on a testing article.
[01:35:54] GreekFreak: rhizome, the user dir is already there...
[01:35:56] sevenseacat: have you checked the factory girl docs?
[01:36:09] rhizome: GreekFreak: so why is it trying to create it? :)
[01:36:19] GreekFreak: rhizome, I don't know haha :P
[01:36:28] rhizome: gist your deploy.rb
[01:36:39] GreekFreak: rhizome, haha I was just about to :P
[01:37:03] banas: Thanks for the link, GreekFreak! sevenseacat, I just skimmed through the GitHub I think, and it discussed mostly how to set up. I'll probably check again. At least I'm not clueless now :D
[01:38:00] GreekFreak: rhizome, https://gist.github.com/tscholiadis/5811057
[01:38:46] GreekFreak: banas, it's pretty good. Start there, and then read on using Rails Guides and other books you might find. At the least, it will help you ask the right questions ;)
[01:39:46] banas: Sure, GreekFreak. The right questions are certainly great things :D
[01:43:51] rhizome: GreekFreak: seems weird, is /home 755? and /home/bluverve_demo exists?
[01:45:44] GreekFreak: rhizome, home is "drwxr-xr-x" with root as owner and /home/bluverve_demo exists with "drwxr-xr-x" and bluverve_demo as owner
[01:52:44] GreekFreak: rhizome, I found the problem. in my deploy_to I have "bluEverve_demo". I have a typo. The guy in #capistrano spotted it..... Thanks for trying :P :)
[01:57:34] rhizome: shit! i looked for an e like three times!
[01:57:45] rhizome: ACTION hangs head
[02:01:46] GreekFreak: rhizome, haha you're hanging your head, and I'm banging it against the wall. I've been trying to figure this out for like 2 hours
[02:04:11] rhizome: next time, i ^f
[02:05:28] banas: Hey guys. Another quick question - what's a fixture?
[02:06:09] rhizome: fixtures are a simple way to set up objects for testing
[02:06:47] apneic: Does anyone happen to know whether :dependent => :destroy locks the destroyed instance as well as all subordinates?
[02:09:07] banas: rhizome: Could you please give me a small example?
[02:14:12] dcope: i have a font in assets/fonts and it doesn't seem to be working. when i access the file via the browser it returns a 0b file
[02:15:00] GreekFreak: banas, a fixture automatically populates a model for you to add to the database. So for example, you'd use a factory to, say, generate email addresses or people's names. Then you'd use fixtures to populate models with what your factory generated. I might not be 100% correct, but I think I'm pretty close. Read that book. It explains all this in working examples
[02:15:04] dcope: same thing as this https://groups.google.com/forum/#!topic/heroku/ZhI5VeE3TDM
[02:16:18] rhizome: banas: create a scaffold, they'll be created with examples
[02:20:38] ajkochanowicz: How much should I be paying for a production site running my rails app?
[02:34:09] rushed: anyone have an activerecord-sqlserver-adapter branch working with 4?
[02:37:17] Mendon: Need an opinion. Should a method that returns the image path for a given object be a view helper or a model method?
[02:42:38] Apane: Any good reads on the development process? I'm having trouble keeping track of the app's overall scope.
[02:43:12] w32stuxnet: can someone help me? I've been trying to get capybara's visit method to work, but I'm getting the following error: undefined method `to_sym' for nil:NilClass - # ./config/initializers/canonical_host.rb:3:in `block in <top (required)>
[02:44:21] helpa: w32stuxnet: 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.
[02:44:21] Radar: w32stuxnet: !code
[02:44:28] Radar: w32stuxnet: You should know better by now :)
[02:44:41] w32stuxnet: Radar: https://gist.github.com/anonymous/17064a07447b0f382d93
[02:44:45] w32stuxnet: I posted it earlier
[02:44:51] Radar: w32stuxnet: I didn't see it.
[02:44:57] w32stuxnet: not your fault :P
[02:44:58] Radar: w32stuxnet: so
[02:45:03] Radar: w32stuxnet: the error contains mention of a file
[02:45:10] Radar: your gist does not contain that file
[02:45:15] Radar: I cannot express my disappointment in words.
[02:45:17] Apane: w32stuxnet: !code
[02:45:23] Radar: Apane: Too bad so sad.
[02:45:29] Radar: Apane: helpa is pretty choosy about who it speaks to
[02:45:51] w32stuxnet: hmm Radar, yeah
[02:46:05] w32stuxnet: I was thinking it was a file from a gem, seems you're right
[02:46:05] Apane: Ah that's a shame
[02:46:23] Radar: Funny. The guy who's spent 7 years in this channel debugging other people's problems is right about something.
[02:47:12] sevenseacat: Radar: nowai.
[02:47:14] w32stuxnet: oh man, you don't want to know how old I am. :S
[02:47:22] Radar: w32stuxnet: I am 225.
[02:47:30] Radar: seriously, two-hundred-and-twenty-five years old
[02:47:45] w32stuxnet: dude, you should be dribbling…. a lot...
[02:47:45] philcrissman_: Radar: I think you're off by one.
[02:47:47] Radar: (ok, more seriously twenty-five)
[02:48:04] Radar: On the internet nobody cares if you're a cat or 13.
[02:48:13] Radar: Just be cool.
[02:48:33] philcrissman_: but seriously, if you're a cat who can type, you should tell people because wow.
[02:48:59] w32stuxnet: where are you guys based?
[02:49:35] sevenseacat: perth, australia.
[02:50:05] w32stuxnet: I recall having heard that from you before sevenseacat - Radar?
[02:51:18] Radar: w32stuxnet: Melbourne, Australia mostly. So far this year it's also been Washington DC, New York, Bend (in Oregon), Las Vegas, Los Angeles, San Francisco and Wellington (in New Zealand)
[02:51:41] sevenseacat: he travels. a lot.
[02:51:46] w32stuxnet: working holiday, or working working?
[02:51:49] Radar: Like ridiculously.
[02:51:51] w32stuxnet: must be profitable
[02:52:14] Radar: most of that was work. New York and DC (for only the second time) was holiday with my girlfriend
[02:52:52] Radar: Ruby on Rails has allowed me to do all that and I'm very thankful for that
[02:53:05] Radar: (DHH is still a dick, no matter how much I make off his work)
[02:55:09] w32stuxnet: so I am guessing you consult/freelance?
[02:55:56] Radar: I work for http://spreecommerce.com doing a large amount of the open source work and I'm currently working on a JS frontend for our API using Backbone.Marionette, which is pretty neat.
[02:56:35] Radar: In my spare time I write books like http://manning.com/katz (which is now http://manning.com/bigg2, being revised by THE Steve Klabnik) and http://leanpub.com/multi-tenancy-rails
[02:56:49] Apane: Radar: Cool stuff, going to check them out
[03:00:26] Radar: thanks Apane :)
[03:02:29] w32stuxnet: that's cool, Radar
[03:04:05] Apane: Radar: Np, Spree seems like an interesting platform for e-commerce. How long have you been coding with Rails?
[03:07:45] Radar: Apane: Since 1.1.2. So ~April 9 2006.
[03:11:01] Apane: Radar: Right on!
[03:13:07] Radar: hm, should grab lunch sometime today
[03:13:29] rushed: Ruby 2 / Rails 4 compatible branch of activerecord-sqlserver-adapter, anyone have one?
[03:20:43] bphogan: Radar: hi :)
[03:20:49] Radar: bphogan: howdy
[03:24:09] bphogan: I'm in gem hell right now. Converting a 2.3.5 app to bundler so I can do security fixes. The client is on a shared server. We could just throw some cPanel on top of this and my life would be complete.
[03:26:14] rushed: bphogan: get off the shared server, upgrade to 3 :)
[03:26:43] bphogan: rushed: lol already tried. they don't want to pay for that.
[03:27:14] bphogan: and all I can do is scratch my head going "wait…. it would be cheaper… cos you're paying me to…. never mind. I like money."
[03:27:29] bphogan: people are funny
[03:27:30] rushed: bphogan: can the app live on one of the available free tiers? heroku, aws?
[03:27:50] rushed: bphogan: (aws is limited to a year, but it doesn't sound like you're in long term thinking land atm)
[03:27:58] w32stuxnet: Radar, I'm getting the following error: https://gist.github.com/anonymous/afc9e573d5710ad63b57 for this RSpec test: https://gist.github.com/anonymous/f0e78417bf545188be7d
[03:28:02] w32stuxnet: Can't find model User?
[03:28:12] mek_: Is there an equivalent of setattr() in ruby to add an attribute to a class instance?
[03:28:26] bphogan: rushed: it very much could not live on heroku but it could live on aws.
[03:28:31] w32stuxnet: It most certainly exists - I've had to deal with this problem once before, and I remember finding the answer. But it's slipped my mind
[03:28:34] mek_: I've seen send and a few other methods but none seem to be working.
[03:28:42] w32stuxnet: mek_ update_attribute from activerecord?
[03:28:57] mek_: w32stuxnet: I can give that a try.
[03:29:00] w32stuxnet: mek_ http://apidock.com/rails/ActiveRecord/Base/update_attribute
[03:29:09] mek_: w32stuxnet: Thanks for the docs
[03:29:21] w32stuxnet: that's the one for only one attribute, you can use update_attributes and pass in a hash too
[03:31:34] mek_: w32stuxnet: That seems like what I am trying to accomplish, however I see a NoMethodError "undefined method 'foo=' for #<Bar: ...>"
[03:32:23] mek_: w32stuxnet: After attempting some_bar.update_attribute('foo', foo)
[03:33:47] w32stuxnet: is it attr_accessible in your model?
[03:33:53] w32stuxnet: the foo attribute, I mean
[03:34:04] rushed: mek_: where are you expecting the target properties to have come from (activerecord based on the db, created manually, etc) & what are you trying to do?
[03:34:36] rushed: w32stuxnet: attr_accessible != attr_accessor
[03:35:09] w32stuxnet: shouldn't that work if it's attr_accessible and is present in the database?
[03:35:29] mek_: rushed: I am expecting 'foo' to not be an attribute of Bar at all. I want to inject additional attributes into my Bar instance depending on runtime conditions.
[03:35:31] w32stuxnet: oh, so he wants to add it on the fly?
[03:36:14] w32stuxnet: Then I think rushed is right, the variable needs to also be set as an attr_accessor in the model I believe
[03:36:24] w32stuxnet: it gives you a getter and setter, though it doesn't put it into the database.
[03:36:25] rushed: mek_: you'll need to .send(:attr_accessor, :foo) to the target class
[03:36:57] mek_: rushed: I'll give that a try -- I had previously tried send with different arguments.
[03:37:16] mek_: rushed + w32stuxnet: Thanks for the advice
[03:37:36] w32stuxnet: no worries, I think rushed's help was more gosu than mine.
[03:37:59] rushed: mek_: still you might want to explain what you're trying to do, because if you're unnecessarily jumping right to meta-programming you might be making things harder for yourself in the near future :)
[03:38:40] w32stuxnet: mek_ one thing I'd add to that is wondering why you need to create these on the fly - can you not predict what the added member variables will be before you run the program?
[03:39:08] w32stuxnet: hey rushed, you have any idea why my rspec test might not be able to access my active record models?
[03:40:12] Apane: Hm, I'm kind of dissapointed with RailsCasts pro subscription. I've just subscribed and the episodes don't seem very fruitful thus far. What's upsetting is the fact that most episodes are built upon the former one. Not in all cases but in most. This makes it super hard to follow along without going backwards. In other-words - there aren't many episodes starting from scratch. You're sort
[03:40:12] Apane: of cast into the middle of app creation. He basically shows you how to implement certain features/gems into existing applications. This all fine, albeit, I'd like to know if there is a better way use the pro-subscription.
[03:40:27] rushed: w32stuxnet: what folder is project_template_spec.rb in?
[03:40:44] sevenseacat: Apane: thats kinda the point
[03:40:56] w32stuxnet: rushed: /spec/integration/
[03:41:00] w32stuxnet: I also had it under /spec/features
[03:41:01] sevenseacat: Apane:he's not building entire apps from scratch, he's showing you tips and tricks with gems you might not have seen
[03:41:04] w32stuxnet: but that is where the error was first turning up
[03:41:15] w32stuxnet: I find it weird that the active record models are out of scope
[03:41:44] rushed: w32stuxnet: so for integration/request/whatever you want to call them you only interact via the browser
[03:41:49] mek_: w32stuxnet, rushed: I have some class People (Bar in this example) who by association (and not directly) have statuses (which are determined in/by another model). This information is currently unavailble so I want to generate a bunch of statuses dynamically (randomly) and set a 'status' attr within these People.
[03:42:04] mek_: s/unavailble/unavailable
[03:42:18] sevenseacat: Apane: also, there's a shitton of free railscast episodes, you didn't need to subscribe to see what they were like.
[03:42:31] w32stuxnet: rushed: sure - but I have that before(:each) there so that I don't hAve to manually log in using the capybara helpers
[03:42:41] w32stuxnet: rushed: and I have definitely been able to do this before.
[03:42:48] rushed: mek_: so you'll probably want to setup the relationships and use the delegate helper
[03:43:39] mek_: rushed: Sometimes I wonder why this language makes me take such a roundabout route.
[03:43:40] Apane: sevenseacat: I suppose - I need to fiddle around with them more. Basically, I'm looking for some practical application of these gems.
[03:43:40] w32stuxnet: mek_ as rushed said, why not set up the relationship? Surely it will make your life easier
[03:43:44] rushed: w32stuxnet: nope, you need different sign in helpers for request specs vs controller/model specs
[03:44:02] w32stuxnet: mek_ yeah, to start with it can be a bit hard to wrap your head around, but after a little while it is much better than something like PHP...
[03:44:06] rushed: w32stuxnet: ex http://stackoverflow.com/questions/5865555/how-to-do-integration-testing-with-rspec-and-devise-cancan
[03:44:12] sevenseacat: Apane: thats what the railscasts do? the ones about gems nearly always start with 'heres an application that should do x, and here's how we can use gem y to do it'
[03:44:36] rushed: mek_: delegating properties to the place they live as opposed to duplicating them is not roundabout :)
[03:44:54] mek_: w32stuxnet: What if they don
[03:45:04] mek_: Whoops, sorry --
[03:45:13] mek_: rushed: What if they don't live anywhere?
[03:45:21] w32stuxnet: something always lives somewhere :P
[03:45:25] w32stuxnet: Doesn't a person have a status, always?
[03:45:42] mek_: w32stuxnet: In this case no.
[03:45:44] w32stuxnet: You could do a has_many through another model to the other model and store a bit of extra information in the relationship model?
[03:46:03] mek_: This is just random data which is being generated at runtime to test out an interface component.
[03:46:22] Apane: sevenseacat: Hrm, I guess it's good to have in the back pocket incase I need to add certain features to an app.
[03:46:36] Apane: sevenseacat: Seems like a good use case in that sense
[03:47:04] w32stuxnet: ffs, I found my issue
[03:47:19] w32stuxnet: And it was stupid
[04:01:24] Radar: w32stuxnet: what was it?
[04:02:06] w32stuxnet: There never was a user model in this project - they are named other things.
[04:02:15] w32stuxnet: Hence my frustration with myself
[04:02:45] mek_: Is the following not real life? bars is a list of Bar instances, foo is some list. Bar has a method @@foo: <% 0.upto(10).each do |i| @bars[i].foo = foos.sample() end %>
[04:03:33] w32stuxnet: goddamn it, my brain
[04:05:14] w32stuxnet: is food a list, or foo?
[04:06:00] mek_: Is there perhaps something intrinsically wrong with assignment within a list comprehension, perhaps?
[04:06:44] pontiki: are you getting an error, or an unexpected result?
[04:07:13] w32stuxnet: is <% a typo or an actual operator, I must ask?
[04:07:20] w32stuxnet: because if so, TIL
[04:07:27] pontiki: is @@foo actuallysome kind of method, or a class variable like you have shown it?
[04:07:40] pontiki: w32stuxnet: that's an erb delimiter
[04:08:04] w32stuxnet: I didn't notice, I thought that was all ruby code
[04:08:08] pontiki: it says to process the contents of <% .. %> as ruby an return it
[04:08:27] mek_: pontiki: a class method. I also tried within Bar: class << self; attr_accessor :foo end
[04:08:40] w32stuxnet: one tip I can give, though it's not entirely useful to you right now mek_ is that you shouldn't be putting logic into your view
[04:08:46] mek_: Either way I get method undefined
[04:08:50] pontiki: class accessors are written a cattr_accessor
[04:09:00] pontiki: attr_accessor are instance accessors
[04:09:12] w32stuxnet: again, one of those wanky rails things which turns out to be very useful later on
[04:09:22] pontiki: and to complete the picture, method accessors are written as mattr_accessor
[04:09:40] rncrtr: I have a grid of items, and I want to use ajax to update them. Do I make a million forms, around each item, or one form around all? I have no code yet.
[04:09:51] mek_: w32stuxnet: I do appreciate that advice. I'm coming from 6+ years of Python so not being able to use something like setattr is blowing my mind
[04:10:05] rhizome: rncrtr: partial
[04:10:08] pontiki: make no forms at all
[04:10:28] rncrtr: Don't I need a form to use jquery?
[04:10:32] pontiki: just hook your ajax to an onclick of the DOM object
[04:10:38] w32stuxnet: that isn't to say that you can't do that to normal ruby classes, active record restricts you for some reason
[04:11:05] mek_: w32stuxnet: I see.
[04:11:06] rncrtr: pontiki: can I do that and still send it to a rails end point?
[04:11:20] rncrtr: items/new for example?
[04:11:33] pontiki: sure -- the onclick would fire an ajax call with your rails api
[04:11:40] pontiki: well, wait
[04:11:51] pontiki: you said you had a grid of items
[04:11:52] rncrtr: I was using a link to, and it gives me a 406
[04:11:59] pontiki: are these data entry items?
[04:12:02] rncrtr: yes, so all items are on same page
[04:12:13] rncrtr: Yes, I will enter text for each
[04:12:15] pontiki: or just data that you want to cycle
[04:12:21] pontiki: misunderstood
[04:12:30] pontiki: i was thinking a grid showing data
[04:12:46] rncrtr: oh no, sorry, like a catalog with descriptions
[04:12:57] pontiki: that doesn't help
[04:13:08] rhizome: like a page of pinterest tiles
[04:13:17] pontiki: you mean a bunch of input and textarea fields?
[04:14:20] pontiki: how is it to be used? if it's a whole page full of inputs and textareas, and it's to be submitted en masse, a single form would do it
[04:14:41] pontiki: show a whole page of things and making the user submit them individually would be cruel
[04:14:57] pontiki: anyway, yes, then, you can wire your form to an ajax call
[04:15:02] rhizome: sometimes it seems like people are reluctant to describe what they're doing in terms of what's been done before. present company excepted of course, I've seen this at companies where I got the stinkeye for describing implementing tag completion and formatting "like stackoverflow does."
[04:15:07] rncrtr: I only want to submit one item's data and update it
[04:15:40] rncrtr: and likely replace the item with it's updated data too
[04:15:46] rhizome: in fact, i think i'll use that as an interview question
[04:16:11] pontiki: rhizome: "Describe how you'd implement a Q&A system that uses tagging" ?
[04:16:17] pontiki: great question
[04:16:42] pontiki: rncrtr: i am now thoroughly confused as to what you want to do
[04:17:13] pontiki: what's the starting point look like?
[04:17:53] rncrtr: pontiki: initially columns with an "add card" link, which produces a "card" where you can fill in some text, and keep adding cards
[04:18:15] rncrtr: Then, edit each one selectively as you need to
[04:18:36] pontiki: you don't actually *need* a form at all
[04:18:47] rncrtr: so the data needs to save via ajax independently but display all of them at once
[04:19:08] rncrtr: well, I tried without a form, but it won't load anything from the create.js.erb file
[04:20:19] pontiki: this would be just dead easy using backbonejs or emberjs
[04:20:20] rncrtr: I've read a lot on UJS and stuff, but there doesn't seem to be anything about formless ajax. I'm using a link_to to add something, but that may not be right
[04:20:30] rncrtr: or what the rules of jquery in rails is
[04:20:46] rncrtr: like I send it to new, but create is what renders?
[04:21:01] pontiki: well, no sure here
[04:21:30] pontiki: in standard rails idiom, create populates the record and saves it to the db, then redirects to show
[04:21:44] pontiki: using ajax, might be doing something else here tho
[04:22:05] pontiki: i guess i'll bow out as i don't know the particular framework you're using for the js
[04:22:17] pontiki: like i said, this is just dead easy using backbonejs
[04:22:20] rncrtr: all the tutorials like railscasts and nettuts say to send it to the new method and only make a create.js.erb file to render back the result as js
[04:22:36] pontiki: i haven't seen any of them
[04:22:52] pontiki: so bowing out it is
[04:23:25] rncrtr: this seems like one of those things everyone just knows and I don't get it yet. thanks.
[04:23:33] w32stuxnet: does anyone know how to stop chrome from auto-closing its window when it is being used as the driver for capybara/cucumber in rspec testing?
[04:24:01] w32stuxnet: I run it, and save_and_open_page, then it closes the window automatically - *and* closes the page with the save_and_open_page
[04:33:05] Mendon: w32stuxnet: I'm not sure, but you should look into a headless driver for Capybara.
[04:35:22] pontiki: i'm assuming w32stuxnet *wants* the browser page to stay up; having *no* browser page at all seems contrapurpose
[04:38:46] pontiki: honestly, the only way i can think of is basically monkeypatch quit :( there has to be a better way
[04:39:25] pontiki: does capy have a hook it runs at the end before quitting?
[04:47:35] w32stuxnet: I"m going to have a look at this webkit capybara plugin though
[04:47:49] w32stuxnet: I think that it should still be able to give me save_and_open_page capability
[04:49:16] sevenseacat: i wonder if capybara-webkit has gotten any less buggy
[04:51:03] sj26: I like phantomjs via selenium
[04:51:38] sj26: Which preserves any selenium sodomization you may need to perform, so switching to chrome/firefox/etc. is still possible
[04:53:24] sj26: I like being able to `ir b` and `page.debug` when things go awry
[04:54:29] Apane: Porn sites like pornhub are super lucrative. I'm curious, are the videos populated manually? or via RSS feeds/parsing?
[04:56:47] s2013_: by magic Apane
[04:56:49] Apane: A friend is thinking of starting a site. Just curious as to the best way to go about building it
[04:57:11] s2013: a "friend' eh
[04:57:33] Apane: s2013: yessir
[04:57:54] s2013: no clue Apane
[05:01:24] rue: I do believe most videos are populated
[05:01:33] rue: Would be a little boring otherwise, no?
[05:01:34] Apane: s2013: no worriesszz
[05:07:07] w32stuxnet: and he's back: anyone know how to login_as a devise model that isn't a "User" model? I have users with different names
[05:07:21] w32stuxnet: though when I try to login_as an instance of one, it doesn't let me in in my tests
[05:27:49] Radar: w32stuxnet: login_as(user, :scope => :other_scope_name)
[05:35:15] sevenseacat: w32stuxnet: you're also in perth?
[05:39:47] w32stuxnet: nah sevenseacat, I'm in brisbane
[05:39:49] w32stuxnet: thanks Radar
[05:39:52] w32stuxnet: not working though :(
[05:39:59] w32stuxnet: I'm still at it, I'll try some things
[05:40:24] sevenseacat: ah ok, I assumed from (i assume it was you) posting on /r/perth that you were here
[05:40:47] w32stuxnet: ooh. No, I do the /r/brisbane+sydney+perth+etc+etc thing
[05:40:59] w32stuxnet: Since /r/australia is just a political wankfest
[05:44:58] w32stuxnet: you clock on, I clock off
[05:48:46] tagrudev: still stays good though
[06:03:49] tagrudev: http://www.sitepoint.com/wp-content/uploads/1/files/2013/06/languages.png
[06:05:24] certainty: tagrudev: yolo
[06:05:35] tagrudev: certainty, sup mate
[06:06:47] certainty: tagrudev: going to be a hot day
[06:07:29] tagrudev: certainty, yeah 18-33C
[06:07:56] slash_nick: it seems certain
[06:08:17] tagrudev: sevenseacat, http://www.stumbleupon.com/su/8qXAHu/www.eligr.com/2010/08/why-never-to-ask-favors-from-the-graphic-designers/
[06:08:36] sevenseacat: haha ive seen this before
[06:08:47] tagrudev: yeah me too cats :D
[06:08:47] sevenseacat: david thorne is a legendary troll
[06:09:02] slash_nick: +1 for clear instructions, I almost read it bottom to top :p
[06:09:44] trollface: tagrudev, i'd buy that on a shirt
[06:09:48] trollface: but replace haml with slim
[06:10:26] tagrudev: trollface, I agree on that :D
[06:10:37] trollface: oh wtf im trollface
[06:10:40] trollface: damnit freenode
[06:10:59] Paradox: slim is so damn nice
[06:11:11] Paradox: esp when you define custom tags
[06:11:22] certainty: i don't like slim
[06:11:52] certainty: I feel locked up with it
[06:12:25] Paradox: i liked the speed boosts it used to (still does?) have over haml
[06:12:39] Paradox: and the syntax felt cleaner
[06:12:44] Paradox: no % soup for HTML5
[06:12:49] sj26: slim is super slick
[06:13:10] sj26: i started writing a temple version of haml which would theoretically be as fast as slim, but got bored and was using slim everywhere anyway
[06:13:20] sevenseacat: ive tried it once or twice, and every time i try it it just feels horribly awkward
[06:13:49] sj26: sevenseacat: that's what HAML-newbies say about HTML -> HAML
[06:13:54] tagrudev: need to remind you the
[06:13:58] tagrudev: yolo benchmark ?
[06:14:02] tagrudev: https://github.com/tagrudev/yolonizer/blob/master/yolo-benchmark.md
[06:14:09] sevenseacat: sj26: i never said that when going from HTML to HAML :)
[06:14:15] Paradox: statistics when allowing gorillas
[06:14:25] Paradox: dont let SWAG influence your numbers
[06:14:46] slash_nick: that was hilarious, re: missing missy
[06:15:41] tagrudev: that post makes me cry out of laugh every time :D
[06:16:00] slash_nick: i cried, coughed, woke people up
[06:16:09] slash_nick: pretty much lost it
[06:16:23] certainty: tagrudev: dreh den swag auf
[06:16:23] tagrudev: my favorite is - I think, that benchmark will give answer for question what is faster???
[06:16:52] tagrudev: certainty, now I will replay that n00b song all day
[06:17:25] tagrudev: got to make it my ringtone
[06:17:40] tagrudev: from the moment - "I am gettin moneyyyy ohhhh"
[06:17:57] certainty: that reminds me, today is my last day with a cellphone
[06:18:29] tagrudev: you buy a new one ? :D
[06:19:03] certainty: tagrudev: hehe no.
[06:19:33] certainty: I wont use one anymore
[06:20:03] tagrudev: don't tell me - http://bostinno.streetwise.co/2013/06/13/swedish-coder-turned-mountain-man-takes-to-woods-for-start-up/
[06:20:10] certainty: it's a tracking and surveillance device
[06:20:26] certainty: <- rms-certainty
[06:21:01] tagrudev: this has anything to do with Obama visiting Germany :D and his pocket Prism App ?
[06:21:15] w32stuxnet: Radar: that line that you gave me, login_as(user, :scope => :other_scope_name) - how do I get that to work for a devise model called MemberContact? I've tried :member_contact, :membercontact and :user, none wokr.
[06:21:39] Paradox: guys, according to new US law
[06:21:39] certainty: tagrudev: hehe, nope. I've been planning this for some time now
[06:21:45] Paradox: you have to add gem 'prism' to your bundles
[06:21:48] slash_nick: w32stuxnet: did you gist the MemberContact model?
[06:21:49] Paradox: otherwise your app will be shut down
[06:21:57] w32stuxnet: neg. I'll do that now.
[06:21:59] slash_nick: Paradox: it's already in rails
[06:22:18] Paradox: slash_nick, but you need the prism gem to enable it
[06:22:23] w32stuxnet: slash_nick: https://gist.github.com/emilevictor/915f4532c7f94bb1477e
[06:22:53] Radar: w32stuxnet: step 1) Look at Devise source for definition of login_as
[06:23:00] Radar: step 2) if not found in Devise, look at Warden
[06:23:05] Radar: Step 3) What does the method do?
[06:23:53] Radar: w32stuxnet: to my knowledge, login_as(member_contact, :scope => :member_contact) is the correct syntax
[06:24:05] w32stuxnet: 'tis not working :(
[06:24:12] w32stuxnet: and all the documentation that I'm reading seems to agree with both of us
[06:24:12] Radar: cool story
[06:24:26] Paradox: Radar, cool story bro
[06:24:57] Radar: w32stuxnet: put the app on GitHub? Reproduce the issue in a dummy app?
[06:25:07] Radar: It's really fucking hard to debug it without having something to tinker around with.
[06:25:25] sevenseacat: you know it's bad when Radar swears.
[06:25:36] Radar: fucking oath
[06:25:38] slash_nick: Sofa king bad
[06:25:58] sevenseacat: that was like the name of my bowling team last year. lol.
[06:26:06] sevenseacat: 'cept we were sofa king good
[06:41:24] oceanbreeze: Sup guys, every day i need to download second file http://www.cbr.ru/mcirabis/?Prtid=bic  on this url, id like to automate that process, where should i start?
[06:41:35] oceanbreeze: the file is named as tomorrow date, should i parse the date, and then if date is correct(tomorrow), file should be downloaded and placed in folder?
[06:41:43] oceanbreeze: Can you give me an idea how script should look like?
[06:41:52] oceanbreeze: bik_dc_2068_20062013.zip  this one
[06:46:08] sevenseacat: anyone here familiar with remotipart? i have a form with a file field i'm submitting via ajax, and my response is always getting picked up by the ajax:error callback even when successful
[06:49:51] certainty: sevenseacat: what kind of response do you have? maybe it's a naive implementation that only interprets 20x as success? (ok unlikely, but you know)
[06:49:54] rvanlieshout: i've just discovered that one yesterday
[06:50:36] sevenseacat: rails is responding with a 200 and a json blob
[06:51:00] rhizome: oceanbreeze: is that parent span's id always "UC_Plug_58051_ActualFiles"?
[06:51:02] sevenseacat: `render json: { flash: t('flash.composite_invitations.create.notice') }`
[06:51:25] certainty: hmm should be definitely a success then
[06:51:42] rvanlieshout: is the json valid?
[06:52:20] sevenseacat: feh i think it's to do with remotipart wrapping it in html
[06:53:29] sevenseacat: i am over this
[07:00:09] sevenseacat: anyone know of any alternatives for file fields via ajax that actually work?
[07:01:06] certainty: sevenseacat: why does it have to be ajax? may be an ignorant question, but still
[07:01:21] sevenseacat: its a form in a modal window
[07:02:00] certainty: hmm and that's why it must be ajax?
[07:02:14] certainty: ACTION didn't know that
[07:02:24] certainty: i don't use this modern stuff :D
[07:02:32] sevenseacat: i dont usually either
[07:02:48] sevenseacat: which is why im hitting massive roadblocks every time i open my editor
[07:02:58] slash_nick: lemme look, think I had that somewhere in an app
[07:03:09] certainty: help is on their way :)
[07:07:09] slash_nick: sevenseacat: I can't find it in my code, but you'd probably rather see the docs for what I used anyway: http://www.malsup.com/jquery/form/
[07:07:34] slash_nick: It's a feature that got built to spec then dropped
[07:07:50] amh345: i think she has multiple file fields.
[07:08:08] RubyPanther: sevenseacat: http://thechangelog.com/remotipart-rails-3-ajax-file-uploads-made-easy/
[07:08:15] amh345: here's some js i used from… somewhere. https://gist.github.com/anonymous/63f36c2810cbb6c2cd17
[07:08:16] sevenseacat: amh345: no, just one.
[07:08:20] amh345: oh. just one?
[07:08:32] sevenseacat: RubyPanther: thats what im trying to use.
[07:08:35] slash_nick: I think it's just an on-change-ajax-submit kind of thing
[07:09:04] tagrudev: there was a gem for that sevenseacat let me search for it
[07:09:37] tagrudev: https://github.com/JangoSteve/remotipart
[07:10:05] sevenseacat: yep, thats what isnt working also.
[07:10:18] slash_nick: sevenseacat: I used $(".file_field").on("change", "#file_field", function(){$(this).ajaxSubmit()}); //essentially
[07:10:44] slash_nick: sevenseacat: and I've already linked to jquery.form.js (which supplies ajaxSubmit())
[07:12:54] RubyPanther: sevenseacat: there is always the old-fashioned way... http://viralpatel.net/blogs/ajax-style-file-uploading-using-hidden-iframe/
[07:13:00] slash_nick: sevenseacat: you can also easily add a progress bar usingjQuery. ajaxSubmit()
[07:23:59] sevenseacat: time to ditch the ajax
[07:26:41] Aristata: DataMapper: Can anyone explain this weirdness to me? http://pastie.org/private/cqtwsfzwm6tj8iqhugzoig
[07:28:25] sevenseacat: sure! http://blog.hasmanythrough.com/2008/2/27/count-length-size
[07:29:43] Aristata: sevenseacat: My hero
[07:29:55] Aristata: Been trying to wrap my head around this bug for an hour or so now
[07:32:56] Macaveli: How dirty is using "flash" in rails ?
[07:35:01] Macaveli: sevenseacat, I will try to explain. hold on I will typ in gist
[07:37:37] defswork: so , with rails' default behaviour of wrapping all controller specific js into application.js at deploy - does anyone envisage page loading issues as a load of js fires that isn't relevant to most pages ?
[07:38:27] defswork: this also means you have to be mindful of what classes/ids you use too as you could end up with wrong triggers ?
[07:38:31] sevenseacat: page loading issues how?
[07:38:43] sevenseacat: yes, it means you have to be mindful to not write stupid JS.
[07:39:00] defswork: sevenseacat, if I have js triggers specific for a page - they will fire on all other pages and just not match (or they might inadvertently match on wrong pages)
[07:39:26] defswork: or do you wrap all your pages in page specific tag and ensure that is in your find matches ?
[07:39:59] defswork: or check url in your js before running any jquery finds ?
[07:40:02] tagrudev: second argument of sevenseacat applies
[07:41:12] Macaveli: sevenseacat, https://gist.github.com/YOUConsulting/b98e3c2b048c9f3f430b see step 3.2 I want to use flash for that instead of hidden_field_tag or Maybe use both
[07:42:05] defswork: $(this).find(':input:visible:enabled:first').focus(); < take that seeming harmless js that sets focus to first input field
[07:42:28] sevenseacat: Macaveli: flash is for notices to be displayed on the page. not for form data.
[07:42:45] defswork: it will do that find on every page - which is mostly pointless as a good number wont have inputs
[07:42:48] certainty: bah, i hate this autofocus stuff
[07:42:54] sevenseacat: defswork: i wouldnt call that seemingly harmless but okay
[07:43:01] sevenseacat: see - stupid JS
[07:43:05] tagrudev: Macaveli, I would handle this on the client side
[07:43:06] defswork: sevenseacat, how stupid
[07:43:31] sevenseacat: 'it will do that find on every page which is mostly pointless'
[07:43:46] sevenseacat: and even for most pages that do have inputs, autofocus is going to piss off your users
[07:43:48] Macaveli: tagrudev, please elaborate
[07:44:13] defswork: sevenseacat, why ? it means they are in the first field on a form - otherwise they go to mouse, point and click
[07:44:30] tagrudev: Macaveli, well when the form is submitted I will check if everything is ok if not I will break the submission and flash a notice
[07:45:02] sevenseacat: defswork: so if you must annoy your users, only try to run that on pages that have a form
[07:45:19] Macaveli: tagrudev, that is currently the case already, but the param profile_pics get emptied so I lose the users uploaded image
[07:45:21] defswork: sevenseacat, by looking for a form first ?
[07:45:44] sevenseacat: by looking for *something*. that kind of JS is not smart,
[07:45:47] tagrudev: Macaveli, I don't see js
[07:46:07] defswork: sevenseacat, I just see that as wasteful - I know where the forms are and I would have normally just added the js include to those pages
[07:46:19] defswork: but thats not the convention nowadays
[07:46:28] sevenseacat: then don't use the asset pipeline, easy
[07:46:49] sevenseacat: the asset pipeline is designed to make serving and caching js easy, if you refuse to use it, thats on your head.
[07:47:15] defswork: sevenseacat, it's not a case of refusing to use it - I'm just asking because using it is the convention now
[07:47:32] sevenseacat: and we've told you multiple ways and you're still saying its 'wasteful'
[07:47:36] Macaveli: tagrudev, the js that I use https://gist.github.com/YOUConsulting/c3b6614cfa6d8ba47261
[07:47:43] defswork: sevenseacat, and I just see some aspects of it as lazy
[07:47:45] sevenseacat: hint - the javascript you write is guaranteed to be far more wasteful than a single check for a form
[07:47:53] defswork: sevenseacat, have you had too much coffee or something ?
[07:48:15] tagrudev: Macaveli, and I don't see you handling the form
[07:48:19] sevenseacat: no. im just waiting to hear an actual argument from you.
[07:48:24] sevenseacat: and i got bored while waiting
[07:48:29] defswork: I'm now arguing - I'm asking
[07:48:41] tagrudev: but you're not reading
[07:48:43] sevenseacat: ok, you asked, we already answered
[07:48:49] defswork: for all I know you do some magic in your pipelined js that only fires for specific pages
[07:49:09] sevenseacat: yeah its called checking for the presence of things before we try to run code on them
[07:49:18] sevenseacat: but you saw that as wasteful
[07:49:24] defswork: sevenseacat, that what a jquery finder does....
[07:49:38] Macaveli: tagrudev, I check that in my apply_controller to see if the input is valid
[07:50:23] defswork: sevenseacat, so, lets now assume I have an application with 500 controllers, and a lot of js, lets says 1500 checks to see if something is on the page
[07:50:55] defswork: they are all legitimate checks to see if the page contains x,y,z before doing something
[07:50:56] sevenseacat: now let's assume something realistic
[07:51:04] defswork: but on 3 our of 1500 are every relevant per page
[07:51:28] tagrudev: Macaveli, I am talking about handling this on the client side mate -> check on form submit if first_name input is empty if it is do nothing else send the form
[07:51:32] universa1: defswork: why not just insert the js on the pages where it's needed?
[07:51:51] universa1: instead of on all pages...
[07:52:00] defswork: universa1, thats now non-conventional - thats how I do it
[07:52:03] tagrudev: universa1, cause any other developer working on this project would shit bricks :)
[07:53:21] defswork: I'm not in this position - I'm just questioning the premise of loading all js into one big bundle that triggers on all page loads and wondering if either there should be a mechanism for determining pages in that or if the per-page approach still has merit
[07:53:39] defswork: but clearly some people here are looking for a fight
[07:53:48] defswork: instead of an intelligent discussion
[07:54:10] defswork: name calling and sneering at people really doesn't help anyone
[07:54:18] rhizome: you don't have to load all js into one big bundle
[07:54:30] sevenseacat: who called anyone names?
[07:54:47] sevenseacat: i called some of the js you write stupid, but you are not your code are you
[07:54:57] diabel232: i need good recipes for ruby on rails production for CHEF
[07:55:15] defswork: you seen my code ?
[07:55:50] sevenseacat: the bits you share as illustrations of your examples
[07:56:06] universa1: defswork: delivering the js and "activating" it are two different things.
[07:56:09] defswork: seriously pal - just take a chill pill and perhaps share your experiences and approaches instead of just demeaning any attempts are reasonable discussion
[07:56:15] Macaveli: tagrudev, I see. Can you put something in your params directly ? Normally I use like params["personal_info"]["profile_pic"] but Now I need to get the content from the file_field in there any clue ?
[07:56:30] defswork: universa1, exactly - it's the activating per page thing I'm curious about
[07:56:32] sevenseacat: shit, we're insulting AND demeaning now.
[07:56:52] defswork: sevenseacat, at least you are now listening
[07:57:20] universa1: defswork: i'm happy if i get a simple js function done, but where is the problem with "activating" it per page?
[07:57:50] universa1: defswork:<script>MyFanyFunctions.cool_workings(some_element_id);</script>
[07:58:34] defswork: universa1, I just see firing jquery finders on pages that I know won't match as wasteful and wondered if there was "norm" for determining what per page stillinside the asset wrap up
[07:58:58] universa1: defswork: why do you need to fire jquery finders?
[07:59:08] tagrudev: Macaveli, I am not sure how's that connected to the thing you were asking. You may search for file upload using ajax
[07:59:20] universa1: defswork: some_form; content_for :js do; some_form_js; end
[07:59:27] defswork: universa1, to add event triggers etc..
[07:59:56] defswork: universa1, I thought inline js was frowned upon
[08:00:01] tagrudev: sevenseacat, hmm have you tried that http://www.uploadify.com/ ?
[08:00:45] defswork: universa1, unobtrusive and all that
[08:00:48] universa1: defswork: all your js is defined in your assets, just call it at the end of your page to "activate" it...
[08:00:59] universa1: defswork: i don't see how that is obtrusive...
[08:01:31] defswork: universa1, ok - that makes sense
[08:02:34] universa1: it looks like you need to read up on that stuff, because that's in essence what was tried to tell you...
[08:02:36] rhizome: defswork: asset libraries: http://guides.rubyonrails.org/asset_pipeline.html#using-index-files
[08:03:27] defswork: universa1, nah the best I got was "stupid js"
[08:03:41] defswork: universa1, thanks for explaining a real approach ;)
[08:04:02] rhizome: javascript_include_tag 'mediaplayer'
[08:04:02] universa1: defswork: people just don't expect to holds hands for everything.
[08:04:43] defswork: universa1, Not asking for hand holding - just to understand other ways of doing things
[08:05:37] defswork: rhizome, thats old school and cumbersome now - you have to specifically list the js to get it to precompile
[08:06:12] defswork: rhizome, I create my js with blah.pre.js and added a pattern for .pre.* to the precompile list
[08:06:21] defswork: but it's cludgey
[08:06:30] rhizome: no, it's new school and modular. the "specific list" is the manifest of the pieces of the library
[08:06:41] universa1: defswork: just: o0
[08:07:06] defswork: rhizome, yeah but then you need a library for every use
[08:07:38] universa1: first rule in programming: my way of doing things/my code is wrong. others most likely got it better.
[08:07:44] defswork: I did this (a long time ago) config.assets.precompile += Dir.foreach(Hr::Application.root.to_s + '/app/assets/javascripts').collect {|p| p =~ /.*\.pre.js/ ? p : nil }.compact
[08:07:54] defswork: universa1, I agree completely - thats why I asked in the first place
[08:08:26] universa1: defswork: and yet whenever someone tells you something you're calling;: old school, uncool, ....
[08:08:45] sevenseacat: thats why i embraced the asset pipeline and its manifests and you know what? it works perfectly.
[08:09:02] universa1: s/perfectly/very good/ ;-)
[08:09:47] defswork: universa1, I meant that per page js is - by default everything in app/asset/javascript is pulled in to application.js (require tree is there by default)
[08:10:10] sevenseacat: require_tree is the first thing that gets deleted in my apps
[08:10:20] universa1: defswork: so what? ohh noes the browser cached my 20kb js...
[08:10:45] defswork: so you either have to turn your per page js into libs or remove the require tree
[08:10:46] defswork: but it's there by default - so it's convention
[08:10:54] defswork: if 99% of devs remove it maybe the convention is wronfg
[08:10:57] sevenseacat: convention is to use test::unit too
[08:11:09] sevenseacat: because it's all there by default
[08:11:27] sevenseacat: welcome to opinionated software
[08:11:35] universa1: maybe it's not a convention, but a default that works well for people starting with rails.
[08:11:47] universa1: once you know what you're doing you're changing it.
[08:11:53] defswork: well I like to assume that most of rails' conventions are good ones
[08:11:56] universa1: or even when you don't.
[08:12:07] defswork: so try to adhere to them if I can
[08:12:10] universa1: maybe not every default is a convention.
[08:12:34] defswork: universa1, sure
[08:15:54] krz: if config.force_sll is set to true. why does app.root_url in the console return a link with http://.. ?
[08:16:18] defswork: try force_ssl ?
[08:16:41] sevenseacat: haha i was going to suggest that
[08:16:59] krz: i didn't get that
[08:17:33] defswork: krz, is config.force_sll a typo just here ?
[08:18:12] krz: config.force_ssl in config/environments/production.rb
[08:18:15] krz: not a typo
[08:18:20] krz: actual setting
[08:18:30] defswork: " if config.force_sll is set to true" ;)
[08:18:35] krz: force_ssl not force_sll
[08:18:46] krz: typo on irc
[08:19:18] defswork: krz, what version of rails ?
[08:19:54] defswork: as per http://www.simonecarletti.com/blog/2011/05/configuring-rails-3-https-ssl/ ?
[08:21:47] krz: defswork: thats what i have. config.force_ssl = true in production.rb. ssl works on the web app via the browser. now when i go into console. and type app.root_url it returns https://www.foo......
[08:21:58] krz: it returns http://www.foo.....
[08:22:45] universa1: krz: rails c production?
[08:22:48] krz: its like url helpers are ignoring the protocol setting
[08:22:51] krz: universa1: yep
[08:23:12] Macaveli: anyone have a solution to check if an string is already base64 encoded?
[08:23:40] universa1: Macaveli: check that it only contains base64 allowed characters?
[08:23:42] defswork: http://stackoverflow.com/questions/8571501/how-to-check-whether-the-string-is-base64-encoded-or-not
[08:23:44] krz: app.root_url(:protocol => 'https') will return with https. but why does this need to be explicit?
[08:24:08] defswork: krz, is it only root_url that is http ?
[08:24:11] adac: Is it a bad idea to log into a database instead of a file?
[08:24:14] slash_nick: Macaveli: http://www.ruby-doc.org/core-1.9.3/String.html#method-i-encoding
[08:24:18] krz: defswork: all url's
[08:24:22] slash_nick: try "foooo".encoding
[08:25:55] universa1: adac: depends.
[08:26:40] universa1: adac: iirc xing (german linkedin "clone") does some sort of logging to some kind of database, and runs some analysis over that.
[08:26:54] universa1: live stats etc...
[08:26:59] slash_nick: irb(main):006:0> Base64.encode64('Send reinforcements').encoding #=> #<Encoding:US-ASCII>
[08:27:59] adac: universa1, what would be an argument against logging into a database?
[08:29:36] universa1: adac: i don't know, addtional overhead, are you going to do something with the data, ...
[08:29:42] universa1: adac: never thought about it.
[08:29:59] universa1: but as always, it's not a yes/no question, but a: it depends ;)
[08:30:19] slash_nick: Macaveli: what about trying to decode the base 64 string using http://ruby-doc.org/stdlib-2.0/libdoc/base64/rdoc/Base64.html#method-i-strict_decode64
[08:30:22] adac: universa1, we thought it would be handy for querying stuff. files are not really that handy.
[08:30:31] slash_nick: Macaveli: if it raises, you'd know it wasn't base 64
[08:30:31] adac: universa1, yeah i see...
[08:31:39] universa1: there should be some stuff on storing the logs for querying
[08:32:03] adac: universa1, we thought we might will write a deamon that reads out the log files from time to time and then writes it additionally into a db
[08:32:15] adac: so we would have both :)
[08:32:15] slash_nick: Macaveli: although #strict_decode64 seems to raise if the string was not encoded using #strict_encode64
[08:32:42] adac: universa1, if you remember the name of that query stuff that would be cool!
[08:33:00] universa1: adac: but then, do you always need it, do you need all information, do you need specific information (=> audit trails), :-)
[08:33:45] universa1: adac: not sure, but maybe this was part of it: https://github.com/Graylog2
[08:35:30] Macaveli: slash_nick, will try thanks!
[08:38:32] horrror: is there a way to use Textacular full text search inside an SQL query but to keep it as efficient? Sort of like, Tag.find(:all, :conditions => ['column = ?, "bla_column"]).basic_search(title: "bla bla")
[08:38:49] horrror: This approach takes forever
[08:40:10] universa1: horrror: use a database with full text search capabilities.
[08:40:22] horrror: I'm using Postgres
[08:40:27] adac: universa1, ah yes I know that pink greylog thingy :)
[08:40:28] universa1: no clue what textacular is though.
[08:40:43] universa1: adac: might be a bit oversized/overpowered maybe
[08:40:54] universa1: but most likely cool to have, once it is set up :-)
[08:41:17] horrror: universa1: I'm using Postgresql , how should I query it then?
[08:41:22] adac: universa1, yeah but the colors!! :P
[08:41:25] universa1: horrror: !g postgres full text search
[08:41:57] universa1: adac: yeah, i don't understand that either... ;) but i guess changing that doesn't take too long ;)
[08:42:21] adac: hehe that is true universa1 :-)
[08:42:53] universa1: horrror: and if you're feeling extremely adventorous today, add a rails / rails 3 into that search query ;)
[08:43:23] horrror: universa1: you're on fire
[08:43:38] universa1: horrror: ;-)
[08:45:10] le_gars: Hi! I have a question about I18. How could I translate the keys of a nested hash?
[08:46:39] universa1: le_gars: elaborate? show an example what you mean exactly ;) put it in a gist
[08:47:04] le_gars: universal: ok will do
[08:48:49] jarr0dsz: hi everyone im having a problem with routing and updating true form already fixed in another project but can't recall how :(
[08:49:07] jarr0dsz: i have a @profile model with form_for @profile that does Started PUT "/profile.1"
[08:49:19] jarr0dsz: everything in route seems ok but overlook something, anyone could point me in right direction?
[08:49:34] jarr0dsz: i should point to profiles#update ofcourse :(
[08:49:48] universa1: jarr0dsz: by now you should know that we want to see your code, your routes, the output of rake routes, ...
[08:49:58] sevenseacat: yeah we've fixed this one for you several times before
[08:50:13] universa1: jarr0dsz: and not just some excerpt you think is releveant, but all of it.
[08:50:28] sevenseacat: for about the fourth time, stop mixing up plurals and singulars in routes
[09:14:29] ben-leblanc: Hi all, anyone have time to answer a few questions on working with threads/processes in rails?
[09:14:59] helpa: ben-leblanc: Don't ask to ask. Just ask your question, and if anybody can help, they will likely try to do so.
[09:14:59] universa1: ben-leblanc: !ask2ask
[09:18:42] ben-leblanc: Ok, so I have a rails-app that should be communicating with an SMPP server. I am using delayed_job to manage the queues (as I want to be able to set when to send the message), but the problem occurs in when I am queuing a messaging job as the smpp process is created in a thread in the rails app, and the delayed job can't communicate with it. Is there a way of communicating between delayed_job and the rails app instances?
[09:19:33] universa1: ben-leblanc: those are seperate processes, so quick answer: no.
[09:20:07] universa1: but why not have the delayed_job connect to the smpp server, too?
[09:20:18] Macaveli: params: profile_pic is filled in, but when I do a new upload via file_field_tag the param does not get overwritten :s
[09:21:16] universa1: ben-leblanc: and if the delayed-job is sending the messages, does your rails app even need a connection to the server?
[09:21:17] ben-leblanc: I am creating the smpp server in a thread within the app. So maybe I should daemonize it then and communicate to it that way?
[09:21:53] helpa: Macaveli: 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:21:53] universa1: Macaveli: !code
[09:23:42] ben-leblanc: I guess my real question is then, what would be the best way to communicate with each other, as the SMPP server needs to be able to send back to the rails app , delivery results etc...
[09:24:43] universa1: ben-leblanc: why not store the delivery results in the database?
[09:26:23] ben-leblanc: universa1: Ok, separate from the rails app completely
[09:27:04] universa1: ben-leblanc: that would be my take, yes. but then i've never used smpp. so this is just my naive opinion :-)
[09:28:01] universa1: ben-leblanc: but imagine what would happen if you have to run your rails app on multiple servers(physical boxes)? the delayed-jobs on different boxes? :-)
[09:28:37] universa1: ben-leblanc: a hard connection feels wrong for me in that case, so a bit more seperated would be better imho :-)
[09:29:03] Macaveli: universa1, I have reformed my question like: With javascript can you set an parameter ?
[09:29:16] Macaveli: rails parameter *
[09:31:03] universa1: Macaveli: counter question: can you do a post/put/get/... request with javascript?
[09:31:06] ben-leblanc: universa1: Makes sense, I guess I was just trying for a quick and dirty solution. For communication between all of them does druby make sense? I am looking at Storimer's process book, but the druby way seems much more straighforward
[09:31:46] ben-leblanc: universa1: I guess I shouldn't tightly couple everything together
[09:31:47] Macaveli: Macaveli, yes :)
[09:32:01] universa1: Macaveli: ok so you got your answer.
[09:36:29] ben-leblanc: universa1: Thanks for the help. I guess I'll go do some more reading, and some redesign :)
[09:36:42] universa1: ben-leblanc: for the communication between the processes i'm clueless. but i would try to keep it simple, maybe "communication" through the database is enough
[09:36:57] universa1: ben-leblanc: yw :-)
[09:37:22] ben-leblanc: universa1: true
[09:38:01] ben-leblanc: universa1: I might be overcomplicating things
[09:54:50] gamov: hello guys! I've just installed ruby 2 and tested my app and it's twice slower than under 1.9.3…. I'm wondering if anybody has seen this
[09:55:07] DaniG2k: ruby 2 is indeed slower
[09:55:22] DaniG2k: gamov: http://benchmarksgame.alioth.debian.org/u64q/benchmark.php?test=all&lang=python3&lang2=yarv&data=u64q
[09:55:33] DaniG2k: ruby 1.9 used to be faster overall than python
[09:55:38] DaniG2k: now ruby 2 is slower
[09:55:45] DaniG2k: but I'm sure they'll improve it with time
[09:56:42] universa1: how are those benchmarks relevant to rails?
[09:56:58] gamov: DaniG2k: :o((( I went to a Ruby conference last week and a speaker was saying that we will gain performance migrating from 1.9.3 to 2.0
[09:57:11] universa1: gamov: ruby 2 is not twice as slow as 1.9.3... where and how did you test your stuff...
[09:57:13] gamov: he is a ruby maintainer..
[09:57:54] gamov: universa1: I use mini-profiler and I just wrote down some benchmarks
[09:58:13] gamov: I'll look into into it...
[10:08:53] krz: "https://s3.amazonaws.com/foo/temporary/encoded/2013_06_19/users/14476/songs/62936/1371635162_ARRUFDEM.mp3" how do i return the path: https://s3.amazonaws.com/foo/temporary/encoded/2013_06_19/users/14476/songs/62936
[10:10:09] universa1: krz: check the stdlib for helper functions, or write your own
[10:11:22] Radar: Where is session[:_csrf_token] set in Rails besides in request_forgery_protection.rb?
[10:11:33] Radar: I'm getting "WARNING: Can't verify CSRF token authenticity" and I can't figure out why.
[10:12:02] universa1: Radar: some js/api request which is not sending the token?
[10:12:34] universa1: happening on some request? or just when booting up the app?
[10:12:56] Radar: git clone git://github.com/radar/saas_book_walkthrough.git; git checkout chapter_4
[10:13:05] Radar: hosted_forums application, bundle install and rails s
[10:13:21] Radar: Access it via a subdomain then that should ask you to sign in
[10:13:30] Radar: once you hit submit on the sign in form, watch the logs for that warning
[10:14:05] universa1: Radar: chapter_4 is not available to me :-) just chapter_2 and master
[10:14:14] Radar: helps if I push it ;)
[10:14:20] Radar: fetch and pull
[10:15:22] universa1: bundling ;)
[10:20:19] universa1: ok, need to set up some local subdomain ;)
[10:23:33] Radar: hm, seems to be that I have to do :domain => :all and not :domain => "all"
[10:24:25] universa1: Radar: getting an apartment error anyways
[10:24:46] universa1: Radar: Apartment::SchemaNotFound -- did rake db:create; rake db:migrate
[10:26:01] Radar: universa1: oh, there's a whole bunch of other set up
[10:26:57] ij: Is there something like zeus(the gem preloader server) for 1.8.7?
[10:28:01] maasha: is there some model validation helper to test the presence of either of two text fields?
[10:28:44] maasha: ACTION is looking in the validation guide at validte :this, presence: true, unless ... (magic?)
[10:28:52] universa1: Radar: :-) alright, off to lunch.
[10:29:00] universa1: maasha: i'd write my own validation.
[10:29:07] Radar: ij: stop using 1.8.7
[10:29:15] maasha: lunch :oP
[10:29:16] ij: Radar, not a viable option
[10:29:29] ij: Radar, You're not really helping that way.
[10:30:22] defswork: ij, is 1.8.7 supported anymore ?
[10:30:36] ij: Not sure.
[10:30:47] ij: Likely.
[10:31:07] defswork: June 2013 ceased
[10:31:18] defswork: no more security fixes etc..
[10:31:24] maasha: universa1: ok, there is a section on that in the guide as well - I was just wondering if there already was a nifty helper
[10:32:15] Radar: ij: Continuing to use 1.8.7 is not a viable option.
[10:32:23] Radar: ij: You really need to upgrade to 1.9.3 as soon as possible.
[10:33:14] ij: Please, stop with your preaching.
[10:34:39] Radar: ij: Stop it with your attitude.
[10:34:49] Radar: ij: I am really encouraging you to do the right thing and you're being a stubborn child.
[10:35:06] ij: What are you going to kick me now?
[10:35:12] Radar: ij: If you keep up the attitude, yes.
[10:35:17] Radar: This channel has no place for that kind.
[10:35:22] ij: Facist.
[10:35:31] Jirka: Hello, can anyone help with Michael Hartl's tutorial?
[10:35:35] Radar: +q *!*@unaffiliated/ij
[10:35:39] Radar: goodbye ij
[10:35:50] helpa: Jirka: Don't ask to ask. Just ask your question, and if anybody can help, they will likely try to do so.
[10:35:50] Radar: Jirka: !ask2ask
[10:36:01] Jirka: Ok, sorry for that.
[10:36:32] Jirka: I've stucked in using PostgreSQL gem.
[10:37:24] Jirka: When I type bundle install, every gem installed but it still gives me this error message:
[10:37:43] defswork: Jirka, use pastie.org etc.. to paste errors
[10:37:48] Radar: what defswork said
[10:38:28] Jirka: http://pastie.org/8058863
[10:39:34] defswork: Jirka, what errrorr ?
[10:39:52] defswork: Jirka, there is no error there
[10:40:13] Jirka: Right, it's not an error, bud pg gem is not installed yet.
[10:40:54] ben-leblanc: Jirka; post your gemfile to a pastie
[10:40:56] defswork: you have set postgres to be used in production only ? and are installing gems in dev mode
[10:41:17] Jirka: http://pastie.org/8058878
[10:41:48] defswork: Jirka, is this when you are deploying to live ? or in development env ?
[10:41:57] ben-leblanc: Jirka: It's just like defswork said
[10:42:49] Jirka: I am sorry, I am quite new in RoR. I think in development environment.
[10:43:12] Jirka: cmd (actually MingW)
[10:43:33] ben-leblanc: Jirka: Do you want to use the pg while you are doing your learning?
[10:44:42] ben-leblanc: Jirka: If so you'll need to remove it from the development group, remove/comment out the sqlite gem and change your db config
[10:44:58] Jirka: I am just learning by that tutorial and hoping I will understand, what I am doing.
[10:45:45] Jirka: So I just can't use two databases?
[10:47:24] ben-leblanc: Jirka: Technically it is possible to use two DBs, but for learning purposes stick to one
[10:47:54] mrstibbons: a question about style. i have namespaced models, so for every namespace there is a file created in my models folder that sets the table name prefix. i think you know what i mean. now i am wondering - if i want to extend the module (aka namespace) with methods - where do i do it? in lib or in this file in my models folder? what is the best place for it?
[10:47:55] Jirka: Ok, there is code how gemfile should look according to tutorial:
[10:48:29] Jirka: http://pastie.org/8058902
[10:48:44] defswork: Jirka, rails is pretty much db agnostic so for learning etc.... you really ought not to notice any difference between one db or another
[10:49:30] defswork: Jirka, that gem file basically says in dev we use sqlite3 - it's lightweight simple db, and in production mode we use postgres
[10:49:53] defswork: you application shouldn't notice the difference unless you have some explicit SQL hidden away
[10:51:08] Jirka: Ok, so everything is right?
[10:51:14] Radar: lol ij absuing me in PM
[10:51:19] Radar: Good thing I banned him :)
[10:51:39] Jirka: Thank you very much :-)
[10:53:33] Jirka: And do you think it's the best way to learn RoR?
[10:54:13] defswork: best way imho is to try to achieve something and then figure out how
[10:54:23] rmd: defswork: You mean conceive?
[10:54:27] Jirka: I have a felloship at one firm, so I want to know at least basics.
[10:54:56] defswork: come up with plan of app you want to write - even if its totally fake and then try to deliver rit
[10:55:10] defswork: and solve the problems along the way
[10:55:38] Jirka: Even if I have no clue what I am doing?
[10:56:17] defswork: you learn to draw by drawing complete things - not by drawing random lines
[11:01:33] certainty: is anybody here using rails4 with namespaced resources? I'm having trouble getting my controller tests to work. Has someone a setup with namespaced routes and working controller tests?
[11:05:56] certainty: I know I'm vague. I just want to know if it generally works or if I'm doing it wrong. This is with rspec-rails
[11:09:26] tagrudev: certainty, you're generally doing it wrong :D
[11:26:13] emanon_: certainty: yesterday i worked with testing of namespaced controllers
[11:26:19] emanon_: everything works fine
[11:27:00] emanon_: rails g rspec:controller api/v10/api
[11:27:22] emanon_: this will generate you rspec for your namespaced ctrller, for example
[11:28:46] certainty: emanon_: ok. I've narrowed it. It works if I omit default options in my routes defaults: { format: 'json' }
[11:29:06] certainty: tagrudev: i know, I know
[11:29:24] tagrudev: no code no help
[11:29:34] certainty: yeah i'm lazy
[11:29:48] weebey_: I have a bit of javascript code that I need for a select group of users. In the controller this is no problem, but I'm not sure how to go about this in javascript. Can I somehow access logic from my models? Otherwise what is the best way to conditionally include a piece of javascript for a given controller or action?
[11:29:50] certainty: if it still were a problem, I'd give code though
[11:29:53] emanon_: one lazy guy kills kitten somewhere
[11:30:11] tagrudev: with a stick, a golf stick
[11:30:30] emanon_: oh geez, so cruel...
[11:30:59] tagrudev: weebey_, ajax ?
[11:35:02] ZenCocoon: Hi, anyone knows well simple_form and collections_radio_buttons? http://stackoverflow.com/questions/17190111/simple-froms-collection-radio-button-and-custom-label-class
[11:35:51] Macaveli: How do delete everything from the beginning of the string until "," occurs? :)
[11:35:55] Macaveli: is it split?
[11:39:19] ZenCocoon: Macaveli: "a string, with, commas".split(',').drop(1).join(',') # http://ruby-doc.org/core-2.0/Array.html#method-i-drop
[11:39:39] certainty: Macaveli: gsub(/^[^,]+/,"")
[11:39:51] certainty: is another possility
[11:40:04] ZenCocoon: Macaveli: their's plenty for sure
[11:40:34] ZenCocoon: certainty: You might want to use \A when scanning for absolute start of the string
[11:41:26] tagrudev: ZenCocoon, https://github.com/plataformatec/simple_form/wiki/_pages
[11:41:33] tagrudev: find you answer here you shall
[11:41:56] ZenCocoon: tagrudev: Digging I will then ;-)
[11:42:01] ZenCocoon: tagrudev: thanks
[11:45:01] Foxandxss: Hi, with an api controller, I post to create and I get a "languages_url" not found (languages is the model)
[11:45:16] Foxandxss: I guess is trying to create the new model url or something?
[11:45:34] ZenCocoon: tagrudev: can't find anything for this one sadly. Custom label class is easy on regular input but on collection_radio_buttons I can't get anything to work
[11:45:53] ZenCocoon: tagrudev: digging the source right now, but so far without much help… they hide this one well ;-)
[11:48:20] Phobos: Hello All !
[11:48:21] tagrudev: ZenCocoon, well here is the code for collection_radio_buttons
[11:48:22] tagrudev: https://github.com/plataformatec/simple_form/blob/master/lib/simple_form/inputs/collection_radio_buttons_input.rb
[11:48:25] tagrudev: then you can define
[11:48:28] tagrudev: https://github.com/plataformatec/simple_form/wiki/Custom-inputs-examples
[11:48:45] Phobos: I am using RailsAdmin plugin and it works just fine for me.. I only wanted to align some form fields in the same line.. for example having address and zip code fields on the same line, But I don't know how to proceed
[11:49:00] Phobos: can someone help me ?
[11:49:12] ZenCocoon: tagrudev: That's what I'm playing with now
[12:00:08] Macaveli: ZenCocoon, your solution worked like a charm! :) I thank you
[12:00:22] ZenCocoon: Macaveli: Glad to hear, enjoy
[12:24:08] tagrudev: http://d24w6bsrhbeh9d.cloudfront.net/photo/arppK2K_700b.jpg
[12:29:12] Macaveli: I still haven't found a way to read an url that contains an image to binary format so I can base 64 encode it and show it and work with it. Does anyone have suggestions for this?
[12:31:17] mikecmpbll: are you wanting to save it, Macaveli ?
[12:31:21] mikecmpbll: in paperclip or something?
[12:31:38] Macaveli: mikecmpbll, send it via xml to SAP :)
[12:31:49] Macaveli: I think this will work : Base64.strict_encode64(open(Base64.strict_decode64(field["VALUE"])).read) testing it atm
[12:32:29] Macaveli: it's via REST and json
[12:32:39] tagrudev: when you use it little children in kindergarten cry
[12:32:39] Macaveli: aalright open works :D
[12:32:41] kevinfagan: Hi folks, I have an ActiveRecord before_create method. Depending on some logic inside this method I may not want the create to happen. Is there a way to abort the create inside of the before_create method?
[12:32:58] Macaveli: tagrudev, do you know what SAP is? And how it is to communicate with it :)
[12:33:10] Nyris: Hello everyone, i am using mongoDB , and i am trying to see if an element is stored in the DB, say a Customer with Id 50 ..i tried this "Customer.exists(serial_num: 50)" but it's not working, any ideas how would i achieve this?
[12:33:19] tagrudev: sap is evil
[12:33:23] mikecmpbll: kevinfagan: return false.
[12:33:34] mikecmpbll: google could have told you that quicker than you typed that question.
[12:33:58] tagrudev: Nyris, Customer.where(serial_num: 50).first
[12:34:08] kevinfagan: mikecmpbll oops, hit return too early :) So returning false works, cool! Thanks!
[12:34:25] Nyris: greate tagrudev, i will try that , thanks
[12:35:05] Macaveli: tagrudev, nathan nelson agrees with you : http://nmn.me/2008/12/sap-is-evil/
[12:35:31] Nyris: tagrudev, is there any matchers to return true or false ?
[12:35:45] Nyris: matchers that *
[12:36:11] tagrudev: Nyris, Customer.where(serial_num: 50).exists?
[12:36:36] Nyris: i see !! i was using it in wrong way ..Thanks a Tone tagrudev
[12:52:13] GeorgesLeYeti: I'm using Nokogiri to parse a xml file. But i have some problem. <a><br/>Hello</a> and <a>Hello</br></a> Here i want to know if br is place before or after Hello
[12:56:43] gerep: Hi all. I'm using RSpec and I can't see what I'm doing wrong because I can't access my user attribute https://gist.github.com/anonymous/5814099
[12:56:47] gerep: can anyone please help?
[12:59:40] Macaveli: can you check in one if something like this: If defined and is empty?
[12:59:58] Macaveli: so you can check if it's empty but only if it's defined
[13:00:10] Macaveli: rails* can check it if it's defined?
[13:04:44] ramblex: Macaveli: the `try' function might be what you want
[13:06:34] gerep: can anyone read this?
[13:07:20] gerep: ramblex can you read this?
[13:07:32] gerep: ramblex I'm just testing :)
[13:07:45] kke: what happens if authenticity token is wrong? does it clear session?
[13:08:10] ramblex: gerep: yes
[13:08:26] gerep: ramblex thanks, I thought I was having problems here :)
[13:16:51] kke: hmmm, are urls like /foo/create are treated differently with authenticity token?
[13:17:45] kke: because my create is the only one that for some reason loses session between /foo/new -> /foo/create
[13:25:23] rsl: morning
[13:28:38] pixelgremlins: can someone tell me how this works.. I have an object @books - @books.updated_at returns : Tue, 18 Jun 2013 19:14:50 UTC +00:00, BUT @books.updated_at < 24.hours.ago returns false... using > returns true..
[13:33:38] kke: yeah, added = hidden_field_tag :authenticity_token, form_authenticity_token and now it works
[13:33:47] pixelgremlins: running command Book.find(:all, :conditions => ["updated_at < ?", 30.days.ago]) returns nothing, but change 30 to 0 and I get the objects I put in yesterday...
[13:33:50] maloik_: pixelgremlins: how close is it to being exactly 24 hours ago ?
[13:34:15] brownies: pixelgremlins: because 24 hours ago was June 18 at 13:30 UTC
[13:34:38] brownies: pixelgremlins: and June 18 at 19:15 UTC is more recent than that...
[13:34:43] maloik_: ah yes there's that :)
[13:35:00] Macaveli: Hello! I'm deploying my code and I'm getting the following: failed: "sh -c 'cd /home/youdev/apps/default/releases/20130619132948 && git diff fatal: Not a git repository (or any of the parent directories): .git 1a364a7147fb16a849eaac27390dde8a18a3d442 --name-only | cat'" on dev-001.youconsulting.openminds.be
[13:35:05] brownies: you probably want to do something like abs(Time.now - @books.updated_at) < 24.hours
[13:35:26] sameerynho: hi, is it possible to have access to class name in scss ?
[13:35:52] brownies: pixelgremlins: and if you want to do it inside that AR query then the best way is probably with a BETWEEN clause
[13:35:57] maloik_: Macaveli: feel free to pm me (hannes from openminds here :-))
[13:36:08] brownies: check the activerecord query guide... they have an example in there.
[13:36:31] pixelgremlins: oh.. I thought 24.hours.ago assumed my time now, and subtracted.. -- I'm doing a price grab via API, and if the prices are 3 days old or older, it's to grab new ones, if it's recent, just pull from DB
[13:36:47] brownies: no, 24.hours.ago just creates a Time object, and then the < or > does a straight comparison
[13:38:02] maloik_: Macaveli: I'm guessing no access to the git repo, which could be due to the fact that you don't have ssh agent forwarding on
[13:39:57] gerep: [RSpec problem] I'm testing a model method call. The token attribute is nil by default, I call a method to update it and save. I've removed the self.save so the value returned should be nil but it's passing the test(https://gist.github.com/anonymous/5814393). Can anyone please help?
[13:40:47] maloik_: gerep: try calling .reload on the object. It's probably saved in memory
[13:41:39] maloik_: also: if the last value of your method is where you set the token to whatever value, the return value of the method will be exactly that which could also be causing it
[13:42:01] rsl: pixelgremlins: updated_at < x means updated_at is a older than.
[13:42:23] rsl: the date value there is less than [in seconds, etc] than x.
[13:42:37] rsl: i had a hard time wrapping my head around that at first myself.
[13:42:40] gerep: maloik_ Yes, I change the token value and save it but I've removed the save, which means the token is not saved, just generated so the user.token is still nil but even not saving it the test is passing
[13:42:55] maloik_: did you read what I said? :-)
[13:43:12] maloik_: I gave two possible explanations for that happening, you didn't invalidate either of them
[13:43:18] maloik_: also: code for the method please
[13:44:04] gerep: maloik_ it's in the User model "generate_api_token"
[13:44:10] brownies: ACTION grumbles
[13:44:16] brownies: he's saying it's saved in memory even if you don't call .save
[13:45:16] gerep: brownies but what I don't understand is that if it's in memory, it's with the token value = nil so the test should not pass anyway, right?
[13:45:36] gerep: brownies the default value for the token attributes is nil
[13:46:33] gerep: brownies the token will not be nil only when I save the user object
[13:49:27] doolinkr: Hey guys. I created a Post-like model on my application, including a reference to the user model. The models have the might associations and the table has user_id, but whenever I create a new Post, user_id is empty.
[13:49:39] brownies: gerep: so which test is failing? line 14?
[13:49:47] brownies: gerep: i would say that it is failing because you never called generate_api_token
[13:50:01] gerep: brownies yes, this test
[13:50:26] gerep: brownies I'm gonna spend more time trying here, it's something really simple that I can't see :)
[13:50:36] gerep: brownies but why it's never called?
[13:53:30] gerep: brownies What I can see now is that even with the self.save commented RSpec seams to be saving it when the method is called, is that possible? :)
[13:53:38] Foxandxss: I created an app skipping sprockets and I move my static assets into /public. Works perfect but I tried (RAILS_ENV="production" rails s) but it doesn't find any route for '/' (normal, I don't have any)
[13:54:44] gerep: brownies I've added a debug point, before calling the 'generate_api_token', the user.token is 'nil', after calling it, the user.token has the value but I haven't saved it, what am I doing wrong?
[13:55:02] dcope: why would rails be serving up a 0 byte length file for a font in my assets?
[13:58:53] dllama: when u change css in dev mode, it should take effect right away correct?
[13:59:24] DouweM_: dllama: Yes
[13:59:50] dllama: i'm trying to test bootstra-responsive, and changed @import bootstrap => @import "bootstra-responsive" but not seeing any changes at all and can't tell if its being served from cache or not
[14:00:20] dllama: bootstrap-responsive*
[14:00:54] mklappstuhl: how do I call a function thats defined in application.js via html element attributes like onclick="myFunction()"
[14:01:02] mklappstuhl: seems to be not defined
[14:01:07] mklappstuhl: sorry for slight OT
[14:01:15] DouweM_: mklappstuhl: You don't
[14:01:24] DouweM_: You add an event handler in your application.js
[14:04:10] mklappstuhl: DouweM_: problem is that it's a custom attribute onchange thats provided by filepicker
[14:04:47] DouweM_: mklappstuhl: Then define It in the window scope
[14:10:14] Foxandxss: If I create a new project and I start the server I see the welcome message (public/index.html) but if I run the server in production, the welcome message is not shown and I get a no route at "/"
[14:10:16] Foxandxss: why is that?
[14:12:12] interactionjaxsn: Foxandxss rails 4?
[14:12:19] Foxandxss: no, rails 3
[14:12:33] Foxandxss: it seems that in local won't work because that index.html should be served by nginx
[14:13:04] Foxandxss: config.serve_static_assets = true does fix the issue to preview (just to preview)
[14:13:11] Foxandxss: so I need to just deploy to the real deal
[14:15:00] interactionjaxsn: Foxandxss: ;) don't spin your wheels here. unless you intend to serve up public/index.
[14:15:18] Foxandxss: I intend to :)
[14:15:29] Foxandxss: not the welcome one, you know :P
[14:16:19] interactionjaxsn: Foxandxss: right but what about app/views/static/welcome.html.erb and setting up a route to that.
[14:17:04] Foxandxss: interactionjaxsn: public/index.html is shorter :P
[14:17:12] Foxandxss: I am not using asset pipeline
[14:17:35] Foxandxss: I create an angular project and I just build the static assets and I dump them into /public
[14:21:16] interactionjaxsn: Foxandxss: i really need to play with something like angular. how do you feel about the other js mvc frameworks out there?
[14:21:40] dllama: I really can't make sense of this. i deleted everything in public/_2assets_, changed bootstra_and_overrides.css.scss to point to bootstrap-responsive. restarted teh app, its still loading up old file. i dont get it :/
[14:22:39] Foxandxss: interactionjaxsn: It depend from person to person but I tried the major ones, and angular has an awesome community of tutorials, blogs, books, libraries...
[14:23:34] interactionjaxsn: Foxandxss: thanks
[14:24:04] Foxandxss: interactionjaxsn: works perfectly with rails and assets pipeline, but I feel like grunt will own in that aspect :P
[14:24:34] interactionjaxsn: ACTION looking up grunt
[14:27:02] dllama: nevermind about what i said before, once again user error
[14:32:25] Foxandxss: interactionjaxsn: basically a way to concat assets, minify, compile coffee. Is what assets pipeline do but with much much more plugins
[14:39:42] dllama: anyone have any suggestions on how to "force" mobile view? for example, iphone reports its width as 980px, so bootstrap responsive still shows standard content for it, @979 is the cut off for the mobile menu
[14:42:18] tgraham: Layer on user agent detection.
[14:43:47] tgraham: Or browser detection, depending on if you want to target more than an iPhone.
[14:44:51] dllama: 2 sites, both using bootstrap - responsive, 1 loads instantly with the responsive menu, other loads in full view (980px) zoomed out to the max
[14:46:51] PigDude: hi, getting used to some new activerecord convention. these operate like querysets in django? that is, I can say x = Model.some_scope, then later, x.order(field_name)?
[14:47:04] yaymukund: PigDude: correct
[14:47:06] PigDude: if that's the case, what do I do when I want that handle, with nothing applied to it?
[14:47:12] PigDude: x = Model is no good of course
[14:47:17] PigDude: but I don't want to eager load
[14:47:19] yaymukund: Model.scoped
[14:47:22] PigDude: thanks yaymukund
[14:47:46] yaymukund: PigDude: worth noting that if you're testing this in console, the act of printing it will execute the query
[14:48:06] yaymukund: so if you do x = User.scoped, the console will try to print the resulta nd that will execute get * from users...
[14:48:20] yaymukund: to prevent sometimes I do x = User.scoped ; nil
[14:49:35] universa1: s/nil/42/ -- because you know why ;)
[14:49:54] PigDude: compeltely unrelated, am I doing something wrong (being verbose) if I say options_from_collection_for_select(@os, id_field_name, 'to_s')?
[14:50:11] PigDude: that is, the 'to_s' feels silly, like it should be the default behavior
[14:50:28] universa1: PigDude: usually you use an attribute, like name or alike
[14:50:47] PigDude: so i am being too low-level using to_s?
[14:51:11] universa1: PigDude: not necessarily.
[14:51:20] PigDude: okee doke :^)
[14:51:23] PigDude: thanks for the advice
[14:53:21] yaymukund: PigDude: if you can be more specific, we might be able to suggest alternatives. I feel like you shouldn't be printing numbers often
[14:54:05] PigDude: yaymukund, oh, i'm not
[14:54:12] yaymukund: for example, instead of printing .cost, I would have something like item.price_string or maybe use a helper. though I dunno. I am not so familiar with the view layer
[14:54:27] PigDude: yaymukund, but I take to_s to be analagous to __unicode__/__str__ in python, toString() in JS, etc.
[14:54:32] PigDude: yaymukund, I am defining to_s on a model class
[14:54:59] yaymukund: ah, I see what you're saying
[14:55:14] yaymukund: hm, yeah I haven't dealt with that before.
[14:55:22] PigDude: the thing is that toString, __str__, etc are called implicitly (in conversion) in those langauges
[14:55:40] PigDude: so I feel silly going through the trouble to provide to_s if I have to call it like any old methoid :^)
[14:55:55] PigDude: anyway that's the bike shed within the bike shed, and my code works anyhow
[15:06:07] PigDude: hm ... i'm using this link helper, but the link takes me to AccountsController#index, not AccountsController#new like it should: <li><%= link_to_unless_current 'Create Account', Account.new %></li>
[15:06:23] PigDude: resources :accounts is in my routes.rb
[15:06:57] PigDude: just trying to get my bearings, how rails handles REST things which is now the recommended way I see
[15:07:02] crankharder: what was wrong with new_account_path
[15:07:09] crankharder: had to make link_to all super 'smart'
[15:07:46] PigDude: new_account_path gets it right, crankharder
[15:07:54] crankharder: of course it does
[15:07:59] PigDude: I saw Account.new-style example in the edge docs, is that wrong?
[15:08:10] crankharder: newfangled newness
[15:08:32] PigDude: <%= url_for(Workshop.new) %> on http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to
[15:08:40] PigDude: ignore the # anchor
[15:09:07] PigDude: i'll use the named helper, thanks crankharder
[15:09:24] DouweM: PigDude: that works, but it requires the pointless instantiation of a new objec
[15:10:02] PigDude: DouweM, i assume you mean pointless in the everyday sense :^)
[15:10:27] PigDude: cuz I don't know how to work rails w/ pointless function :^)
[15:13:37] s2013: PigDude, what exactly is the issue
[15:13:48] PigDude: s2013, none, now!
[15:17:17] _JamieD_: Hi All, anyone know how to add a custom date formatter. This Time::DATE_FORMATS[:insight] = "%Y.%m.%d" only works for DateTime objects and not Date objects as far as I can work out
[15:17:46] terrellt: So - how popular is Draper, and is there a "better" alternative? It seems like a pretty good method of building a presentor.
[15:18:30] _JamieD_: terrellt: I've used draper a lot and think it's pretty good, I've not tried out any of the alternatives
[15:19:11] terrellt: _JamieD_: You're looking for something outside of just Date.strftime?
[15:19:23] _JamieD_: terrellt: my only issue is that debugging can sometimes be harder and the stack trace often doesn't display and decorator lines where the actual issue is
[15:19:48] terrellt: _JamieD_: Because of method_missing?
[15:20:29] andrewvos: I've got a form pointing at /accounts/sign_in, and the form is remote: true. When the request fires it gets redirected to a status page that I've specified. How do I get the page to follow this redirect?
[15:20:53] andrewvos: I have thought about defining my own SessionsController#create but this seems dirty.
[15:21:06] _JamieD_: I'm trying to do post.published_on.to_s(:insight) and have my formatters picked up from the initializer, it works for DateTime objects but not Date objects, seems a bit odd so I thought there might be a different way to define the format
[15:21:30] pixelgremlins: if I want to create a method to be ran from all controllers, models, etc.. do I just throw that in a .rb file in the initializers folder? Using a lot API's and want all my api-calls to just be ran like call_amazon(attrs) return a @doc containing the Nokogiri::XML output
[15:21:52] terrellt: _JamieD_: I haven't heard of something like that - I'd probably just define a method. Hey, maybe a decorator? ;D
[15:22:26] _JamieD_: terrellt: I'm not sure if it's due to method missing, I haven't looked into exactly how draper works internally. The stack trace will often end with a link in the view file that calls draper, which you then know is an error caused in draper
[15:23:02] terrellt: andrewvos: "Get the page to follow this redirect"?
[15:23:12] _JamieD_: I might just change my db field to be a date time and it will work the way I have it
[15:23:19] andrewvos: terrellt: Yep, what about that don't you understand?
[15:23:44] terrellt: andrewvos: So you're pushing out an ajax request, and if it's successful you get back a response from the status page?
[15:24:08] andrewvos: terrellt: Well no, I'm actually getting back the page that devise is told to redirect to after a valid login
[15:25:34] terrellt: andrewvos: You're going to have to use javascript to bind to the success event and if it's true redirect the user.
[15:25:53] terrellt: andrewvos: Also consider enabling JSON functionality in devise so you're not passing around whole pages.
[15:26:08] andrewvos: terrellt: How do I do the latter?
[15:26:38] anannie: Hey are there any contractors around? I need to something done immediately and I'm willing to pay for the hassle
[15:26:58] andrewvos: terrellt: Oh so you're talking about: Instead of using a form, post the data manually?
[15:27:19] scyllinice: anannie: There are plenty in here
[15:27:27] terrellt: andrewvos: No. When you do remote: true it creates javascript events that you can bind to, to see if it was succesful.
[15:27:43] terrellt: andrewvos: As for the devise thing - it's in the config somewhere...I've done it before, but it's been a while.
[15:27:45] andrewvos: terrellt: That causes the page to load though
[15:28:10] terrellt: andrewvos: You just make the form have :format => :json
[15:28:13] andrewvos: Well it causes /accounts/sign_in to redirect to /my_after_login_page
[15:28:13] anannie: scyllinice: Aye.
[15:28:22] andrewvos: terrellt: Oh wow didn't see :format!
[15:35:55] andrewvos: terrellt: Another issue, the url I redirect to is different depending on the type of user
[15:36:10] andrewvos: terrellt: So I can't just bind to ajax:success and redirect somewhere, because I don'tknow where to redirect.
[15:37:03] terrellt: andrewvos: this.url in jQuery should give it to you.
[15:37:41] andrewvos: terrellt: But the page gets loaded twice then?
[15:38:31] terrellt: andrewvos: If you switch to JSON then you get the response, strip .json from the end, and redirect to there. No loading twice.
[15:40:47] andrewvos: terrellt: Switching to json did nothing different with the response I got :9
[15:40:59] terrellt: andrewvos: Are you requesting .json?
[15:41:33] terrellt: andrewvos: You may have to make the status page respond to json as well.
[15:41:52] andrewvos: Yeah, I suppose I would have to
[15:42:12] andrewvos: Or even could just add a /redirect_a_user_to_their_happy_place
[15:42:20] andrewvos: To hell with this, I'm doing that
[15:54:00] billiam: I'm adding an error symbol to a model's :base. I can override the full message for that model via en.yml, but when it's a child of another model (using fields_for :child) the error message is prefixed with the child model name.
[15:54:21] billiam: Is there a way to prevent/override that behavior in one instance?
[15:55:00] brownies: you mean the parent model name?
[15:57:29] billiam: Given a parent model (post) and a child model (comment), an error added to the child model (comment.errors.add(:base, :custom_message)) will result in an error message like : Comment <<translated error message>> when submitting the post form
[16:00:43] brownies: oh. that seems like intended behavior... you added an error to the comment, so it display as "comment blah blah blah"
[16:00:53] grillermo: hey im renaming a resource called Alert to AlertConfig the pluralization according to rails should be alerts_configs or alert_configs ?
[16:00:59] brownies: oh i see your point.
[16:01:14] brownies: there is an AR method that generates those things that you can override
[16:08:16] pixelgremlins: trying to wrap my brain around the best way to do this.. Each book can have multiple prices but ONLY 1 price per condition per merchant ... so for example Merchant_id: 1, Book_id: 1, Condition: "New", if someone tries to insert another book w/ those same values - it will do an update instead... -- so it's like those 3 fields are in essence a Primary Key... is there like a best practice
[16:08:16] pixelgremlins: for something like this, or a tutorial? Any suggestions? Much appreciated!
[16:12:14] joshuawscott: grillermo: alert_configs
[16:12:29] joshuawscott: Try 'AlertConfig'.tableize
[16:12:49] grillermo: thanks, is there a way to disable pluralization in a rails project, like completely?
[16:13:29] joshuawscott: I wouldn't recommend it at all - I've done this and it's a pain
[16:14:08] grillermo: pluralization is a pain...
[16:15:04] rhizome: no it isn't
[16:16:16] pixelgremlins: can I do something like find_or_create_by_book_id_and_merchant_id_and_condition(bookid, merchantid, condition) ?
[16:16:30] joshuawscott: grillermo: do you have an existing database structure that's not pluralized?
[16:17:10] rhizome: pixelgremlins: why not just use .where?
[16:17:38] grillermo: joshuawscott im renaming a model and controllers and all the bells and whistles
[16:21:03] joshuawscott: grillermo: I feel your pain there, but I don't think turning off pluralization will help at all with that.
[16:21:21] mikecmpbll: pluralization is exactly not a pain.
[16:21:23] joshuawscott: pluralization affects a lot of the Rails app.
[16:21:36] grillermo: yeah i'll just try to live with it
[16:21:50] mikecmpbll: it removes pain.
[16:21:58] grillermo: mikecmpbll: lol
[16:22:13] mikecmpbll: it's the anaesthetic to your naming woes.
[16:23:07] joshuawscott: when I started using rails in 2006, I turned off pluralization in my first app because I didn't like it. There were a ton of problems across everything.
[16:24:29] joshuawscott: if you have specific legacy tables, then you can self.table_name = 'alert_config'
[16:26:10] joshuawscott: if the pluralization doesn't work correctly for something, then you can use http://api.rubyonrails.org/classes/ActiveSupport/Inflector/Inflections.html to change pluralizations case-by-case
[16:26:44] dangerousdave: I have always used rails built in testing framework, is there a better way, and if so what do you recomend please?
[16:27:25] grillermo: joshuawscott: oh right i forgot about inflections, thanks
[16:27:34] joshuawscott: dangerousdave: you mean Test::Unit?
[16:28:14] PigDude: using activerecord, how would i express this (as a named scope, i think)? `status is null or status not in CLOSED_STATUSES`?
[16:28:33] Neener54: dangerousdave: We use Rspec and cucumber here, I'm not a big fan of writing cucumber tests, but rspec isn't horrible. I'd give mini-test a shot though
[16:28:39] PigDude: where('status is null or status not in ?', CLOSED_STATUSES) feels ugly.
[16:28:42] DouweM: dangerousdave: there's rspec, which is used and liked by many. check it out I say
[16:29:42] PigDude: I already use a where(field: in_list), so I'd prefer that sort of API
[16:29:52] dangerousdave: joshuawscott: yes
[16:29:57] codelette: Is there any way to submit a form_for(:remote => true) with javascript as format :js?
[16:30:21] codelette: If I submit it with a submit button, it gets posted as :js, but when I submit via javascript, it gets posted as :html
[16:30:31] dangerousdave: Neener54: thanks, how come you use 2 different ones? are they complimentry?
[16:30:33] joshuawscott: dangerousdave: I'd recommend rspec as well
[16:30:53] dangerousdave: DouweM: there seems to be a concensus.
[16:31:18] interactionjaxsn: PigDude: scope :open, lambda { where('status is null or status not in ?', CLOSED_STATUSES) } and call Model.open.where( 'other stuff' )
[16:31:25] dangerousdave: joshuawscott: thanks
[16:31:39] PigDude: ok, so that's as simple as my where call gets then? thanks interactionjaxsn
[16:32:16] PigDude: interactionjaxsn, of course i use the -> {} syntax for lambda :^)
[16:32:29] interactionjaxsn: PigDude: right right... i just have to assume...
[16:32:40] interactionjaxsn: PigDude: stabby lamda... i like the name
[16:32:53] PigDude: i feel like an old man wearing a backwards hat when i write -> () { ...
[16:33:14] PigDude: "this is how the cool kids do it. i'm hip!"
[16:35:31] interactionjaxsn: PigDude: 'or' is interesting from a rails perspective. here is some context and interesting convo in that regard: https://github.com/rails/rails/pull/10891#issuecomment-19168175
[16:35:33] triptec: this give me a almost empty migration, rails generate migration CreateConsumptionTypesWalkTypesJoinTable, is there a way to do this of do I need to manually edit the migration?
[16:36:46] PigDude: interactionjaxsn, he says "Ok, so it seems there are some philosophical resistances against implementing OR.", no reason why though that I found
[16:38:19] interactionjaxsn: PigDude: yeah. I'm not sure how it will go but the discussion is interesting none the less
[16:38:47] rhizome: triptec: you can define the attributes on the command line if you want, but that doesn't allow for all possibilities (default, null, etc.). generally you do edit.
[16:40:42] codeshah: interesting, a client's site is showing up only half vertically … seems when we zoom out and try to get the hwole page, it's still only half
[16:42:34] rhizome: PigDude: if you're looking for a way to avoid a SQL fragment, it's req'd for OR unless you're using a gem that provides a method for it
[16:43:41] PigDude: rhizome, yea, and i prefer to not include a dependency. no big deal, wanted to be sure i'm not missing anything
[16:43:46] PigDude: rhizome, thanks!
[16:44:55] PigDude: should things in ./lib/ be autoloaded? or I have to require each module I use?
[16:45:50] AlchemyFalcon: If A has_many B's, and B has_one C -- can C has_one A :through => B ?
[16:45:59] tbuehlmann: PigDude, in newer rails versions, lib/ is not being autoloaded. but you can add the path so it gets autoloaded
[16:46:35] DouweM: tbuehlmann: starting with what version is that the behavior?
[16:46:43] PigDude: tbuehlmann, how do I do this?
[16:46:56] tbuehlmann: rails 3, iirc
[16:47:42] DouweM: tbuehlmann: lib seems to autoload for me *shrug*
[16:47:53] apeiros: DouweM: then you use either pre-rails 3 or added it
[16:48:08] apeiros: config.autoload_paths or somesuch
[16:48:12] tbuehlmann: PigDude, config/application.rb, `# config.autoload_paths += %W(#{config.root}/extras)`
[16:49:44] AlchemyFalcon: Any thoughts on those associations?
[16:50:57] DouweM: apeiros: I did modify it to also take subdirs of lib, but I though it included lib by default. Looks like I'm mistaken
[16:54:16] apeiros: DouweM: uh, including subdirs of a load path is bad
[16:54:38] s2013: when making an ajax request with jquery do you need to do remote: true?
[16:54:43] apeiros: you gain nothing, but you get increased chances of collisions
[16:56:26] pothibo: can someone please tell me why my functional tests are failing? https://gist.github.com/pothibo/292e1ea0354c32f35058
[16:56:36] pothibo: well, only the last 2
[16:57:54] tbuehlmann: s2013, remote: true is just for links/buttons created with rails helpers
[16:58:38] DouweM: apeiros: huh, looks like you're right. I added that a long time ago when I had just started doing rails and never questioned it. thanks
[17:00:07] s2013: see tbuehlmann im confused as to when to use it
[17:01:04] PigDude: thanks tbuehlmann
[17:01:12] tbuehlmann: use it if you want to send an ajax request AND using link_to/button_to
[17:02:16] tbuehlmann: s2013, if you just use jquery and do the request yourself, no need
[17:02:39] s2013: so on the post url i just put the url to the post?
[17:03:07] tbuehlmann: I don't know your usecase
[17:03:30] s2013: lets say i have a model called person and i want to count the number of votes for that person
[17:03:35] s2013: people can either vote for him or against him
[17:04:54] tbuehlmann: you would then have two links (for/against) which would send POST requests
[17:05:23] s2013: yeah i got that. question is what url do i send it to? it would be the person url right and pass the paramters?
[17:06:58] tbuehlmann: I think I would setup a route for /people/42/vote (or /people/42/vote_for and /people/42/vote_against)
[17:07:44] terrellt: Can you pass parameters that aren't part of the route in a link_to?
[17:07:45] tbuehlmann: or do you have a Vote model? that would change things
[17:08:08] terrellt: tbuehlmann: Even if he did he'd want that route.
[17:08:14] pothibo: terrellt: yes everything you set in your_route_path(…) arguments will be params
[17:08:25] tbuehlmann: the route itself would change
[17:08:45] terrellt: tbuehlmann: Not if votes are nested under people.
[17:08:46] s2013: what would be better tbuehlmann
[17:08:50] s2013: a separate vote model?
[17:09:15] tbuehlmann: it would change to something like POST /people/42/votes
[17:09:16] pothibo: do you want to keep track of the votes for/against?
[17:09:20] terrellt: s2013: I'd make a vote model, and a votes table, just so I could keep a log of all the votes.
[17:09:29] tbuehlmann: s2013, dunno, do you just wanna count votes or do something else with it?
[17:09:51] s2013: well im actually making a simple news submission site. something like reddit
[17:10:08] s2013: so i guess i need to be able to track who voted for which link
[17:10:12] terrellt: s2013: So votes are even tied to users? I'd -definitely- make a votes table.
[17:10:17] tbuehlmann: you might want to check whether one person already voted and stuff, so a Vote model would make sense
[17:10:23] s2013: yeah i think i do have a separate vote model
[17:10:34] s2013: which has a users foregn_key
[17:10:47] s2013: and whether they voted_for or voted_against
[17:11:13] billiam: Rephrasing earlier question: How can I remove the model name (not attribute) prefix from messages in errors.full_messages?
[17:11:14] tbuehlmann: the association would be like User has_many Votes and Vote belongs to User
[17:12:30] s2013: yeah i dont have the problem with associaton problem
[17:12:40] s2013: problem is i dont know how to use ajax so that they wont have to refresh when they vot
[17:14:05] terrellt: s2013: You let the VotesController respond via JSON, bind to the success of the post, and update the vote count based on that response.
[17:14:28] s2013: yeah davidcelis i know its js but im not sure how to get it work with rails
[17:14:38] s2013: terrellt: yeah i think i was missing that part. about responding via json
[17:15:06] terrellt: s2013: You'll want to bind to ajax:success on that link.
[17:15:08] davidcelis: It doesn't even have to respond via JSON. It could just "head :ok" and you increment the counter by 1. Unless you want to increment it to the actual vote count since the user has loaded the page
[17:15:16] s2013: is there something similar wher epeople have done it and i can check it out
[17:16:02] terrellt: davidcelis: It should definitely increment to the actual count.
[17:16:28] terrellt: That may cause confusion I guess.
[17:16:34] davidcelis: terrellt: honestly depends. some users think it's jarring when they click the upvote button and it rises by more than one.
[17:16:39] davidcelis: that's a confusing UX, in my opinion
[17:16:49] terrellt: Just feels like a lie.
[17:16:53] slash_nick: ACTION nods
[17:17:58] slash_nick: votes have three states, up, down, and meh...
[17:18:12] davidcelis: s2013: Here's an example from my own app https://gist.github.com/davidcelis/8223559ceb0882ee1c87
[17:18:13] slash_nick: if you go to up or down... there oughta be a way to get back to meh
[17:18:25] s2013: let me check it. thanks
[17:18:58] davidcelis: er, updated for the relevant parts. refresh it if you already opened
[17:19:42] s2013: so its adding the like to the database?
[17:19:50] davidcelis: The controller action is.
[17:20:26] davidcelis: the $.ajax call just hits a URL, and that URL responds with an empty 200 if it was successful so the client can increment the count and make the button green basically
[17:20:33] davidcelis: it's just javascript
[17:20:56] s2013: can you paste the controller action? i think i have trouble understanding the controller part than the jquery part
[17:21:09] rhizome: on something like reddit, an upvote count skipping multiples makes sense. it all depends on the site and whether it's really useful to sync page state with the db at all times.
[17:23:30] davidcelis: s2013: Refresh
[17:24:14] davidcelis: s2013: Depending on your version of jQuery, `head` responses may always cause error callbacks to be called rather than success callbacks. Apparently Rails `head` responses aren't actually empty, the body is comprised of a single space which jQuery parses as invalid JSON, causing it to enter the error callback even if the response was a 200.
[17:24:18] davidcelis: but that's the general gist of it.
[17:27:00] s2013: k thanks davidcelis let me cehck it
[17:27:40] s2013: got it. let me try on my own im sure ill have questions. thanks
[17:30:17] pixelgremlins: is there a reason this isn't working? @doc = Nokogiri::XML("http://prices.valorebooks.com/lookup-multiple-categories?SiteID=s1pI8Z&ProductCode=9780470458211") @doc.search('//xmlns:product-code').text
[17:31:09] webdestroya: why not '//product-code' ?
[17:32:13] pixelgremlins: cause, someone for some reason I had to use the xmlns for Amazon's API, figured it'd be the same...let me try though
[17:32:40] webdestroya: i think that is only when there are multiple conflicting namespaces
[17:41:13] pixelgremlins: okay, I have @res = http://prices.valorebooks.com/lookup-multiple-categories?SiteID=s1pI8Z&ProductCode=9780470458211 ---- @doc = Nokogiri::XML(@res) @data = @doc.search('//product-id').text and it returns ""
[17:42:27] DouweM: pixelgremlins: I don't see a <product-id> in there. I do <product-code>
[17:43:20] pixelgremlins: product-code also returns ""
[17:45:47] pixelgremlins: for Amazon, I had to do Nokogiri::XML(@res.body), but if I do that for this one, I get undefined method 'body' for string:objectid
[17:47:01] DouweM: pixelgremlins: post some actual code to a gist
[17:49:47] pixelgremlins: https://gist.github.com/pixelgremlins/0c3e9e125338ac238a4f
[17:50:35] pixelgremlins: I think it has to do w/ possibly how the site has formatted their xml? or something, or I'm just not implementing Nokogiri correctly
[17:53:58] DouweM: pixelgremlins: you're asking Nokogiri to parse the literal URL, not its contents
[17:54:20] pixelgremlins: how do I parse the contents?
[17:54:58] DouweM: you need to use Net::HTTP or open-uri to request the page
[17:55:02] pothibo: parsing HTML is not simple
[17:55:21] DouweM: Net::HTTP.get_request(URI.parse(your_url)).body should do it
[17:55:29] DouweM: whoops, *get_response
[17:55:34] Ilya: hy everyone
[17:55:41] DouweM: Ilya: hey
[17:55:46] Ilya: I have a bit of a problem
[17:56:12] pixelgremlins: oh okay, the Amazon gem I'm using probably does that automatically, why I had no problem w/ that...
[17:56:14] DouweM: pixelgremlins: also, why are you storing all that stuff in instance variables?
[17:56:27] Ilya: I need to create a dynamical crontab schedule
[17:56:28] DouweM: pixelgremlins: also, use under_score_methods, not camelCaseMethods
[17:56:41] pixelgremlins: oh okay, thank
[17:56:41] DouweM: pixelgremlins: probably
[17:56:45] Ilya: or crontab-like
[17:57:22] Ilya: users will be able to create and update tasks and set the period from a strict list
[17:57:41] Ilya: can anyone think of a way?
[17:58:10] DouweM: Ilya: run the job every 5 minutes, check which tasks should be run now?
[17:59:25] Ilya: DouweM thought about it. But I thought it's a bit too heavy when the number of tasks runes large
[18:00:11] luist: hey guys… i usually open a console with this: script/rails console production and then i run a command. is there a way to run this command from outside, without opening the console?
[18:00:15] DouweM: Ilya: use threads or even newly spawned processes to run the tasks simultaneously. that'll have the same effect as having multiple cron jobs
[18:00:31] webdestroya: luist: make a rake task
[18:00:54] Ilya: DouweM DelayedJob?
[18:01:03] luist: webdestroya: never did that ^^
[18:01:25] webdestroya: luist: http://railscasts.com/episodes/66-custom-rake-tasks
[18:01:34] DouweM: Ilya: sure, you could also just schedule the tasks to run after x time using delayedjob or sidekiq or whatever
[18:01:34] luist: webdestroya: thanks
[18:02:27] Ilya: DouweM: whenever you mean?
[18:02:43] rhizome: luist: rails runner "code" or rails runner file.rb
[18:02:45] DouweM: Ilya: I meant the word whatever, not the gem whenever ;)
[18:03:56] Ilya: DouweM oh)))
[18:08:45] slash_nick: DouweM: I read your name as "do you owe me?"...
[18:09:48] slash_nick: those letters do something weird in my brain... maybe i'm crazy
[18:11:03] tbuehlmann: it's not just you, in my brain they are also somehow unsorted
[18:11:15] certainty: you both are crazy
[18:11:29] certainty: they told me, you were
[18:11:43] certainty: they know you. they know us all
[18:11:53] Apane: Hrm. So I have a voting system integrated in my app using Active Record Repuration System gem.
[18:12:06] Apane: But I seem to be getting this error when clicking vote up or down: https://gist.github.com/Apane/5816494
[18:12:16] slash_nick: Repurrations?... what did we ever do to kittens
[18:12:26] Apane: see Error msg at the bottom of the gist.
[18:12:38] Apane: reputatation:
[18:12:50] Apane: Reputation
[18:12:56] Apane: Any ideas?
[18:13:28] webdestroya: Apane: theres a gem for that
[18:13:54] rhizome: Apane: route: "member { post :vote }" log: No route matches [GET] "/haikus/1/vote"
[18:13:55] Apane: I'm using the gem 'activerecord-reputation-system'
[18:13:57] rhizome: post vs. get
[18:14:02] DouweM: slash_nick: It's actually my first name and first letter of my last :)
[18:14:31] rhizome: pronounced "dewey?"
[18:14:44] slash_nick: I thought maybe vice-versa first-last... yeah, how's it pronounced? :)
[18:14:47] Apane: rhizome: thx, let me try that
[18:15:14] DouweM: Dow as in Dow Jones, we as in duh
[18:15:28] DouweM: with a w instead of d of course
[18:15:57] rhizome: innerestin'...welsh or something? :)
[18:15:59] Apane: rhizome: Great, that worked.
[18:16:37] rhizome: close enough ;)
[18:17:33] DouweM: My last name, Maan, literally means moon
[18:17:49] pixelgremlins: okay, something is still not working--Net::HTTP is bringing me up some content-- but it gets truncated.. https://gist.github.com/pixelgremlins/98b79f314117289bdd2a
[18:18:13] pixelgremlins: only shows : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n "
[18:20:48] DouweM: if you puts it?
[18:21:11] toretore: curl -g 'http://prices.valorebooks.com/lookup-multiple-categories?SiteID=s1pl8Z&ProductCode=9781934356487'
[18:21:11] toretore: <?xml version="1.0" encoding="UTF-8"?>
[18:21:47] pixelgremlins: if you go to the website you see more than that, and there's definitely more than that on the site
[18:21:48] pixelgremlins: http://prices.valorebooks.com/lookup-multiple-categories?SiteID=s1pI8Z&ProductCode=9780470458211
[18:21:58] toretore: curl -g 'http://prices.valorebooks.com/lookup-multiple-categories?SiteID=s1pl8Z&ProductCode=bogus'
[18:21:59] toretore: <?xml version="1.0" encoding="UTF-8"?>
[18:22:01] pixelgremlins: has to be a way to pull that
[18:22:25] DouweM: view-source:http://prices.valorebooks.com/lookup-multiple-categories?SiteID=s1pI8Z&ProductCode=9780470458211 does have full contents
[18:22:45] slash_nick: looks like an advertisement for valorebooks
[18:23:05] pixelgremlins: I'm doing a price comparison for Textbooks nick
[18:23:17] toretore: Net::HTTP.get_response(URI.parse('http://prices.valorebooks.com/lookup-multiple-categories?SiteID=s1pI8Z&ProductCode=9780470458211')).body
[18:23:17] toretore: => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n <product> … "
[18:23:22] toretore: ure doing it wrong
[18:24:03] pixelgremlins: well, yeah- trying to figure out how to do it 'right' tore
[18:24:20] toretore: by not doing it wrong
[18:24:45] pixelgremlins: well, any suggestions on the 'right' way ?
[18:25:00] toretore: you no give information
[18:25:19] toretore: how you know body truncated??
[18:26:12] pixelgremlins: go to: http://prices.valorebooks.com/lookup-multiple-categories?SiteID=s1pI8Z&ProductCode=9780470458211 and view source
[18:26:34] toretore: how you know body truncated??
[18:26:48] toretore: give info plz
[18:27:09] terrellt: open-uri worked.
[18:27:27] pixelgremlins: oh... ur code just worked...for me..
[18:27:38] wheeee: Hey all. Does anyone have insight into the proper way to look at batch create/edit actions in a proper MVC way
[18:28:06] toretore: wheeee: do you mean mvc or rest?
[18:28:55] wheeee: probably REST, but I also don't want to check if the action is a 'batch create' action through if else within the controller action
[18:29:10] toretore: by not being restful
[18:29:23] toretore: POST /resource/create_multiple
[18:29:41] terrellt: https://github.com/arsduo/batch_api Or something like that.
[18:29:46] toretore: or just allow more than one on regular post
[18:30:14] toretore: it's not something that fits inside what rails calls rest
[18:30:44] wheeee: Why not make a separate batch controlller?
[18:30:56] rhizome: why make a separate batch controller?
[18:31:26] toretore: then you need a separate batch resource
[18:31:43] terrellt: ...Why does a controller have to have a resource?
[18:31:44] toretore: GET /resource/1/batch/3
[18:31:59] toretore: if it's going to be restful it does
[18:32:21] toretore: but now you're probably thinking that resource = model
[18:32:22] terrellt: The "batch controller" thing is essentially what batch_api does, it just uses rack middleware and a defined API.
[18:33:47] toretore: batch_api does multiple requests, it doesn't have one controller that does one request
[18:34:12] toretore: it's not horribly stupid, but it's not the same
[18:35:10] terrellt: This is true.
[18:38:24] nobitanobi: Hi guys, I have an action of a controller that I don't want it to use the application.html.erb, but I want it to use another layout. how can I do that?
[18:38:30] treehau55: I am using roar rails and angular, I have a form for a new action and need to know how to have it initialized with my properites in my representer rather than the ones straight from the model
[18:38:57] toretore: render layout: 'another layout'
[18:39:35] artichoke: i have a match route setup for an action that i want to return a js.erb file (no layout). in the method i have a respond_to block with format.js. any idea why it's not working?
[18:45:32] nobitanobi: I have a question guys, I have a domain pointing to a Heroku app, and I want it to make it point to another one. How long might it take to propagate? If I remove it from the first app, and add it to the second app?
[18:46:00] treehau55: nobitanobi, #dns
[18:46:45] Dysruption: if I want to create a form accessible to all views, where would I place it and are there any naming conventions I should be aware of?
[18:47:14] treehau55: make it a partial and then use the render helper, you have to start it with an underscore e.g. _form.html.erb
[18:47:34] treehau55: place it in application/
[18:48:00] Dysruption: app/partials?
[18:48:25] Dysruption: treehau55: ?
[18:48:33] treehau55: that could work too
[18:48:58] Dysruption: do I need any includes? or can I just render it in the view?
[18:51:55] treehau55: try it out and see im not sure, haven't worked with default rails structure in a while
[18:52:08] luist: webdestroya: hey… how do i pass NUMBER as a parameter when using this task? http://pastie.org/8060389
[18:52:16] treehau55: i want to say everything in layouts/ is available to all views
[18:53:21] webdestroya: luist: like this `task :your_task, [:first_arg, :second_arg] => :environment do |t, args|`
[18:53:31] webdestroya: then inside your task, you can do first_arg = args[:first_arg]
[18:53:48] webdestroya: luist: one sec
[18:54:27] luist: oh i guess i got it
[18:54:42] webdestroya: luist: https://gist.github.com/webdestroya/5816902
[18:55:00] webdestroya: luist: then you call it like `bundle exec rake close[123]`
[18:55:34] luist: hm.. okay
[19:05:26] bricker: How do you guys deal with schema.rb across branches, when there are merge conflicts with the schema version number
[19:05:37] bricker: very infuriating
[19:06:09] webdestroya: just pick one of them
[19:06:09] workmad3: bricker: I just remove one version and remigrate
[19:06:15] drPoggs: that's what I do too
[19:06:16] webdestroya: then do schema:dump
[19:06:34] workmad3: you could probably just do a schema:dump directly
[19:07:05] bphogan: I always take that as a sign that branches aren't small enough or I'm not merging enough.
[19:08:06] bricker: bphogan: it's just the version number though - if the version number is different in the two schema.rb's, git can't possibly merge them together cleanly
[19:08:38] joshuawscott: bricker: I usually resolve the conflict, and pick the later number.
[19:10:29] bricker: yeah, it's not a big deal, just annoying when that's the only thing keeping a branch from merging cleanly
[19:12:42] lupine: how on earth are the version numbers conflicting?
[19:12:51] lupine: yyyymmddhhmmss not good enough?
[19:13:16] workmad3: lupine: version in branch 1 != version in branch 2
[19:13:31] lupine: oh, sorry, schema.rb
[19:13:37] workmad3: lupine: ya :)
[19:13:42] lupine: I@m not with it right now :D
[19:18:58] ryan_turner: Hi, I have two methods that Im trying to get associated after having made them.
[19:19:14] ryan_turner: One is called Syncs and other is Users
[19:19:34] ryan_turner: Syncs has "initiated_by", which is the user's ID.
[19:19:43] ryan_turner: So, I've added an index on initiated_by
[19:19:57] ryan_turner: on User I added "belongs_to: syncs"
[19:20:17] ryan_turner: and on sync I added "has_one :user, class_name => "User", foreign_key => "initiated_by"
[19:20:36] ryan_turner: When I do .all, should I expect for initiated_by to now by a User object corresponding with taht iD?
[19:20:51] ryan_turner: or am I misunderstanding was the associations serve for.
[19:22:43] interactionjaxsn: ryan_turner: should users have many syncs and syncs belong to users?
[19:22:59] ryan_turner: I originally tried it as the reverse has_many and belongs_to
[19:23:12] ryan_turner: flip-flopping on it still
[19:23:32] ryan_turner: nonetheless, I dont know how to check if what I'm doing is "working" because I don't know if my desired functionality is part of Associations or not.
[19:23:59] interactionjaxsn: Syncs.includes(:user)
[19:24:46] yaymukund: ryan_turner: have you seen this: http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#method-i-belongs_to-label-Options
[19:25:06] ryan_turner: yaymukund, not that specifically, but generally I've seen those.
[19:25:12] ryan_turner: I'm new to rails so I appreciate all of your help.
[19:25:53] yaymukund: huh, I don't think you want `includes` if you're just trying to setup basic associations
[19:26:10] interactionjaxsn: yaymukund: that's just to see if it barfs or not
[19:26:56] yaymukund: I also like .to_sql
[19:27:07] ryan_turner: interactionjaxsn, ok, so where should I put that? Just replace my index view where I'm doing .all for now?
[19:27:20] interactionjaxsn: ryan_turner: rails c
[19:27:21] ryan_turner: err the index's local var **
[19:27:37] ryan_turner: do it in the command prompt.
[19:28:11] slash_nick: hmm I wonder if an engine's install:migrations task would respect the application's "MyEngine::Config" class options (gonna find out pretty soon)
[19:28:14] ryan_turner: Aha, ok, no good. Thanks, this gives me something to work off of.
[19:28:58] ryan_turner: But when I do Sync.all in the future, how do I force it to grab the associated objects?
[19:29:17] slash_nick: i.e. exclude certain tables or columns
[19:29:28] workmad3: ryan_turner: you want to eager-load the users?
[19:30:34] yaymukund: ryan_turner: http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations
[19:31:05] ryan_turner: Hmmm, cant seem to resolve the error when Im doing Sync.includes(:user)
[19:31:16] interactionjaxsn: ryan_turner: what's the error?
[19:31:16] yaymukund: ryan_turner: I think you can also do this declaratively from within the model, but I forget the syntax for that. sorry to just throw docs at you, maybe someone else can provide better help. (I have a meeting now)
[19:31:18] ryan_turner: In Sync I have "initiated_by" but of course in User it's just "id"
[19:31:34] ryan_turner: Mysql2::Error: Unknown column 'users.initiated_by' in 'where clause': SELECT `users`.* FROM `users` WHERE `users`.`initiated_by` IN ('41', '42')
[19:31:42] interactionjaxsn: yaymukund: belongs_to include:
[19:32:04] ryan_turner: So it's trying to find the same column name
[19:32:14] ryan_turner: should be doing select where users.id in
[19:32:50] interactionjaxsn: ryan_turner: right... so it might be backwards?
[19:33:02] ryan_turner: I flipped it in the models
[19:33:11] ryan_turner: user now has_many :syncs
[19:33:21] ryan_turner: and sync now belongs_to :user
[19:33:33] ryan_turner: Still same error
[19:34:20] interactionjaxsn: ryan_turner: User.includes(:syncs)
[19:34:50] helpa: ryan_turner: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[19:34:50] toretore: ryan_turner: !gist your complete model files
[19:35:49] ryan_turner: interactionjaxsn, ok, when doing that I now get NameError: uninitialized constant User::Syncs
[19:36:09] ryan_turner: toretore, ok... dont get distracted lol
[19:36:26] ryan_turner: Err actually these models are reasonably small
[19:37:00] ryan_turner: https://gist.github.com/ryanturner/33facf4f93747a4d64ec
[19:38:11] slash_nick: ryan_turner: those models aren't small
[19:38:21] ryan_turner: slash_nick, ok.
[19:39:09] slash_nick: just saying... :) there's no way for us to know what errors your models might contain without seeing their content
[19:39:17] joshuawscott: belongs_to :user, :foreign_key => :initiated_by
[19:39:37] ryan_turner: Ok, I had that earlier but had the relationship backwards
[19:39:56] joshuawscott: you need it in both places, IIRC
[19:40:11] slash_nick: joshuawscott: that's right
[19:40:45] ryan_turner: when doing User.includes(:syncs) I still get the same uninitialized constant error
[19:41:37] interactionjaxsn: ryan_turner: tell the has_many what the foriegn key is
[19:42:27] ryan_turner: Ok, refresh: https://gist.github.com/ryanturner/33facf4f93747a4d64ec I added them
[19:43:07] ryan_turner: and here's my error: https://gist.github.com/ryanturner/33facf4f93747a4d64ec#comment-848012
[19:43:10] slash_nick: ryan_turner: any way you can add the stack trace for your... thanks
[19:43:32] interactionjaxsn: ryan_turner: and i don't think you need the foreign key on the belongs_to for syncs
[19:45:10] toretore: there is no knowledge shared between "sides" of a relation
[19:45:39] toretore: ryan_turner: restart your console
[19:46:33] workmad3: hmm, that's an odd error
[19:46:42] ryan_turner: restarting the console made User.find(1).syncs work at least.
[19:46:54] ryan_turner: aaaand User.includes(:syncs) work.
[19:47:04] ryan_turner: So, clearly it's the total noob mistake.
[19:47:56] ryan_turner: Sorry, got accustomed to rails server not making me reload.
[19:48:24] workmad3: ryan_turner: you can also issue a 'reload!' in the console
[19:48:53] workmad3: ryan_turner: there's just not a good time to do automatic reloads in the console though, unlike the nice convenient place of 'start of request' for a server :)
[19:49:09] joshuawscott: ryan_turner: I've done rails for 7 years, and I did the same thing last week :)
[19:53:44] yaymukund: ryan_turner: did you solve your problem? sorry, was in a meeting but I have some time now.
[19:54:11] ryan_turner: yaymukund, yes, it was as easy as reload! lol
[19:54:23] ryan_turner: all it needed as :foreign_key
[19:54:28] ryan_turner: but since I didnt reload I had no idea.
[19:55:36] DouweM: workmad3: there's a reload! in the console? oh my god
[19:56:04] workmad3: DouweM: yeah, I hate the fact they put a ! on it though
[19:56:37] yaymukund: I think every engineer has been through that. For me, I usually somehow end up losing 20m testing code in production instead of dev.
[19:56:45] DouweM: yeah, doesn't really seem in place here. but jesus, thanks for pointing that out. I had no idea and was constantly restarting the entire rails console..
[19:58:28] yaymukund: I wonder why it has a bang. It isn't dangerous, is it?
[19:58:49] yaymukund: I guess if your new code has a syntax error, `reload!` will error?
[19:58:58] toretore: it should be reload? instead
[19:59:27] toretore: because sometimes it doesn't behave the way you think
[19:59:56] yaymukund: instead of using reload, I just alwasy have two consoles running
[20:00:04] yaymukund: problem solved
[20:03:25] Shoblak: hi guys, quick question: is there an equivalent of << array operator on hashes?
[20:04:25] DouweM: what? you always need a key and a value, so what would be shorter than hash[key] = value
[20:05:11] slash_nick: ACTION looks up Hash#zip
[20:05:33] slash_nick: oh that's not on hash
[20:08:02] slash_nick: these kinds of things, Shoblak? http://apidock.com/ruby/Hash
[20:09:09] Shoblak: yeah, thing is, the * (splat) throws "odd number of arguments for Hash"
[20:11:32] joshuawscott: Shoblak, what are you trying to do?
[20:14:24] Shoblak: something clearly beyond my reach. messing with arrays of hashes is.. well, messy.
[20:15:50] DouweM: it doesn't need to be. what is your input and what is your expected output?
[20:18:21] Shoblak: I've got an array of hashes that i want to loop through to get a filtered array of hashes with only 1 instance of every object in the original file (represented in hashes) by name "key"
[20:18:47] Shoblak: original array*
[20:21:47] Apane: What time will the startup engineering coursework be up
[20:24:14] joshuawscott: Shoblak, so you're saying you want a new array of hashes with only the key "key"? maybe I'm not understanding what you're saying.
[20:24:27] helpa: Shoblak: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[20:24:27] toretore: Shoblak: !gist your code
[20:24:40] ivarvong: What's the preferred production server for ActionController::Live (Rails 4)? Won't Puma (or any ThreadPool-based server?) run out of threads with long-lived connections?
[20:28:06] toretore: ivarvong: look like it uses threads internally, so you don't have a choice
[20:28:57] toretore: actually, forget i said that
[20:29:00] Shoblak: doh, i was comparing the i on myarrayofhashes do |i| agaisnt the whole filteredarray ( array) instead of filteredarray[index](hash)
[20:29:08] Shoblak: ACTION cratered.
[20:29:53] ivarvong: @toretore i got it to work by mounting a sinatra-websocket rack app in rails 4 using thin (so, eventmachine). but i noticed tenderlove's post was using puma. (that's for WS, obviously, not AC::Live)
[20:31:15] toretore: ivarvong: what does sinatra-websocket have to do with AC::Live?
[20:31:29] toretore: (actually curious)
[20:31:57] ivarvong: toretore: nothing. that was misleading. it was my workaround for not figuring out how to do AC::Live.
[20:33:19] workmad3: http://edgeapi.rubyonrails.org/classes/ActionController/Live.html is illuminating for AC::Live
[20:33:36] workmad3: 'The final caveat is that your actions are executed in a separate thread than the main thread.'
[20:33:52] workmad3: by which I infer that rails itself will spin out a new thread
[20:34:19] toretore: yes, but that doesn't really affect the webserver's connection handling though
[20:34:31] ivarvong: workmad3: so what happens when you have a number concurrent of users thats bigger than the threadpool?
[20:35:02] workmad3: ivarvong: I doubt the AC::Live threads will be in (or taken from) the app server's threadpool in the case of puma or similar
[20:35:49] toretore: actually, the main thread doesn't wait for the live thread, so it'll return to the webserver
[20:35:57] toretore: so workmad3 is right
[20:37:07] workmad3: however, it probably also means that the number of threads in your server is open-ended, so if you aren't careful with how you use AC::Live, you could easily end up with hundreds (or thousands) of threads causing contention issues
[20:38:30] toretore: c10k with rails
[20:38:31] workmad3: all in all, I'd personally consider using an EM websocket server in a single background thread (or something you can spin out into a separate runner) rather than AC::Live for any serious long-running connections
[20:38:42] ivarvong: workmad3: cool. is that here: https://github.com/rails/rails/blob/5654b0a27e35ace26e65e6f6a2a420da8c81583a/actionpack/lib/action_controller/metal/live.rb#L116 ?
[20:39:12] workmad3: AC::Live seems more like it's good for streaming out a quick burst of your basic page, followed by some startup SSEs to kick a js-heavy app into gear
[20:39:26] ivarvong: workmad3: yeah, it seems like an eventloop makes sense for the long-lived stuff?
[20:39:28] workmad3: and then close the connection quickly so it doesn't hog server resources
[20:40:06] toretore: workmad3: well, if you have lots of rails traffic, you're probably going to have lots of servers to begin with, so it may not be an issue
[20:40:43] workmad3: ivarvong: not just that, but also using websockets (a protocol designed for long-term, persistent connections) rather than long-polling (which is frequently not proxy-friendly and almost always needs 'keep-alive' events to be sent down the connection to stop it being closed) makes sense IMO
[20:41:25] bjorn_: Hi so i am using ActiveAdmin and am trying to implement batch actions ; i have used the selectable_column in my index block but unfortanelty this does not select all records
[20:41:27] workmad3: toretore: if you have lots of servers, chances are you're less likely to want unbounded thread pools in those servers ;)
[20:41:44] workmad3: toretore: it would really screw with your load balancing
[20:41:54] toretore: workmad3: true
[20:42:00] ivarvong: toretore: i think the threadpool-based stuff usually has an upper-end of 16-32 threads. you could go higher, but more ram… so is 32 concurrent users considered lots of traffic? am i missing something?
[20:42:02] toretore: bjorn_: !activeadmin
[20:42:12] toretore: i really thought there'd be one for that
[20:42:36] toretore: ivarvong: it doesn't have anything to do with e.g. puma's threadpool
[20:42:45] momomomomo: toretore: helper down again?
[20:42:51] workmad3: ivarvong: 'concurrent users' is a difficult concept with request-response style http servers
[20:42:54] toretore: rails has its own "unlimited pool"
[20:43:03] toretore: helpa: hello
[20:43:08] helpa: helpa: Nom nom. Thanks, toretore!
[20:43:08] toretore: helpa: !botsnack
[20:43:10] helpa: Please do not use fake variables for your name such as "foo", "bar" or "x". Use the real names, as if it makes sense to you it probably will make sense to the people helping you.
[20:43:12] bjorn_: toretore?
[20:43:19] momomomomo: !activeadmin
[20:43:22] momomomomo: !active_admin
[20:43:25] momomomomo: maybe that's not a command then?
[20:43:26] helpa: momomomomo: talk to epochwolf about ActiveAdmin
[20:43:26] workmad3: momomomomo: !aa
[20:43:29] toretore: bjorn_: stop using activeadmin and save yourself from the pain
[20:43:35] toretore: there it is
[20:43:41] bjorn_: but i enjoy using it
[20:43:43] epochwolf: activeadmin?
[20:43:54] bjorn_: hi epochwolf
[20:43:55] workmad3: bjorn_: masochist
[20:44:10] toretore: people take pleasure in the strangest things
[20:44:27] bjorn_: ill paste in my old question
[20:44:27] bjorn_: Hi so i am using ActiveAdmin and am trying to implement batch actions ; i have used the selectable_column in my index block but unfortanelty this does not select all records
[20:44:38] bjorn_: do you know a solution for this epochwolf
[20:45:11] bjorn_: is that the correct way to do it or am i missing something?
[20:46:01] ivarvong: workmad3: fair enough. imagine an Angular/Ember webapp using POSTs for writes and SSE for pushing model updates from the server to all the clients. i now think it might work better with a separate websocket app, but i was playing with the idea. it would some long-running AC::Live requests for sure that way.
[20:46:07] epochwolf: bjorn_: I have no idea. :/
[20:46:15] momomomomo: helpa, I'll pull out your tapes & smash your vacuum tubes
[20:46:22] workmad3: ivarvong: I wouldn't use SSEs to push out data updates in the first place
[20:46:22] nobitanobi: I have a question... I have changed a CNAME of my domain that was pointing to a Heroku app, and make it point to another Heroku app. I have removed the domain from the old app by doing heroku:domains remove..., but now when I visit mydomain, I get "Heroku | No such app"
[20:46:34] workmad3: ivarvong: I'd only use them for sending an event saying new data was available
[20:46:39] nobitanobi: however, when I do host mydomain.com, it actually points to the new Heroku app.
[20:46:39] bjorn_: epochwolf: sorry someone said you would have knowledge on the issue
[20:47:07] epochwolf: ACTION shrugs
[20:47:14] ivarvong: workmad3: ok. but either way, a connection open for the length of each client, right?
[20:47:18] epochwolf: ACTION doesn't know everything
[20:47:29] toretore: workmad3: curious why you would use ws over sse, i don't have much experience with either
[20:47:32] momomomomo: bjorn_: Your best bet is probably the active admin mailing list / channel (if there is one) or docs
[20:47:50] bjorn_: i read the docs
[20:48:01] bjorn_: and implemented it the way it supposed to be implemented
[20:48:15] momomomomo: Not saying you didn't, but those might be more narrow channels, where everyone knows about ActiveAdmin
[20:48:31] bragkek: Sup what setup should i use for hosting a rails app? I currently instlaled mariadb and apache, rvm, ruby 2.0 and rails 3.2.13, did i forgot something?
[20:48:32] workmad3: toretore: tbh, I'd probably do a form of SSE over WS in reality
[20:48:44] workmad3: toretore: I prefer to push out events that trigger a pull of data, rather than pushing data
[20:48:57] toretore: workmad3: any particular reason for that?
[20:49:13] Apane: We should gather 4-5 of the best rails devs in here and start a project. Split equity evenly :-). We have enough man power here to disrupt and industry
[20:49:38] epochwolf: bjorn_: I'm one of the more knowledgable people on activeadmin but I'm not the expert I once was.
[20:49:41] toretore: think of all that synergy
[20:49:42] momomomomo: bragkek: A good starting point: http://rubyonrails.org/deploy - don't take that as gospel, some of the info is old, and I'd recommend googling around to see what fits your need
[20:50:44] bragkek: momomomomo: thanks, i would like to try ohusion passenger
[20:51:03] workmad3: toretore: long-running connections need keep-alive and reconnect logic in them... I'd rather only be relying on small amounts of data from that source that I can easily recover from, as opposed to larger chunks of data that could be part transmitted, or lost entirely if the connection is down at the wrong time
[20:51:14] momomomomo: it's good if you're just looking to quickly put something up, but most people don't use it in production for any real volume of traffic bragkek
[20:51:40] workmad3: toretore: and if an event isn't received, resending it is lightweight, rather than if you've pushed a chunk of data down the wire and it's not received... that's a heavier resend
[20:52:13] ivarvong: bragkek: have you used heroku/similar? pretty awesome to just get stuff out the door.
[20:52:19] bragkek: its that bad momomomomo ?
[20:52:37] ivarvong: workmad3: have you used AC::Live to do that?
[20:52:42] momomomomo: it's not bad, it's just a different need/requirement bragkek
[20:52:55] toretore: workmad3: hm, ok, makes sense. at least for the typical "you have a new message" type of web page information
[20:52:59] workmad3: toretore: follow that up with being then able to split your traffic loads out... a large pool of rails servers for pushing your data out behind load balancers, and then your persistent connections are on a smaller number of servers with tuned configs, to allow them to support much larger numbers of open connections
[20:53:05] bragkek: ivarvong: I am using cloud ubuntu server
[20:53:52] workmad3: you'd likely need to rely on some form of message queue at that point to push updates out though... and channel subscriptions to be able to route updates out to relevant clients
[20:54:04] workmad3: so it does depend on scale, obviously :)
[20:54:18] toretore: workmad3: is there a relation between number of connections / amount of traffic?
[20:54:21] bjorn_: epochwolf: so youv never heard of the selectable column
[20:54:45] workmad3: toretore: well, you have a certain amount of bandwidth for a server
[20:55:25] workmad3: toretore: each connection will have a certain overhead in terms of keep-alive traffic and the like
[20:55:34] toretore: workmad3: sure, but i'd think you'd hit the max connections first most of the time?
[20:55:49] ivarvong: workmad3: right now, any time a model changes, i push a message to sidekiq/redis that JSON's the new model, then the mounted sinatra-websocket app broadcasts the updated model to all the clients.
[20:56:03] workmad3: toretore: if you're keeping your data rates on those long-running connections small, that could be the case
[20:56:05] bragkek: momomomomo: so what is the best/most used solution?
[20:56:13] bjorn_: epochwolf: i am trying to mimic this
[20:56:14] bjorn_: http://demo.activeadmin.info/admin/customers
[20:56:35] workmad3: toretore: but you could tune the server to support a large number of open connections (trunked network cards, increase the number of open sockets allowed in the OS, etc.)
[20:56:43] momomomomo: bragkek: there is no 'best' solution, but there are lots of options. Whatever fits your need - heroku is great if you just want to get something up and don't want to deal with the implementation of anything
[20:56:45] bjorn_: where the selecatable column selects all the items
[20:56:57] toretore: bjorn_: leave poor epochwolf alone, he already said he doesn't know
[20:57:20] workmad3: toretore: you wouldn't want to tune it for larger connections if each connection is going to have large amounts of data pushed down it though... that would seriously mess up your server resources :)
[20:57:33] ivarvong: workmad3: are the SSE/WS endpoints using an EM-based server in that configuration?
[20:58:03] workmad3: ivarvong: I suspect it doesn't really matter at that point
[20:58:27] bragkek: momomomomo: i have to deal with implementation because im using cloud ubuntu server
[20:58:38] fragamus: hey im starting a new project and I need a good base app
[20:58:39] workmad3: ivarvong: event-machine is all about scaling-up to utilize a single machine's resources (same as with threading)... this is scaling-out your architecture to distribute it
[20:58:46] workmad3: ivarvong: they're pretty orthogonal concerns
[20:58:52] toretore: workmad3: right, but the data/connections still have to be made *somewhere*, and this would just transfer them to the rails/whatever servers
[20:58:58] ivarvong: workmad3: even with one thread per client?
[20:58:59] bragkek: momomomomo: which i already configured for ruby development, so what i need atm is a good advice of what we server combo should i use
[20:59:02] momomomomo: bragkek: then start your research engines!
[20:59:30] toretore: ivarvong: "rule of thumb" says event loops are better at lots of small connections
[20:59:42] bragkek: momomomomo: haha okay, will google it tomorrow :) just asked in hope to get some quick reference)
[20:59:49] workmad3: event loops are for IO-bound operations
[20:59:52] bragkek: momomomomo: thanks anyway)
[21:00:30] workmad3: so if the majority of your time is spent in reading from one IO source or writing to another, then event loops are quite an efficient way to use a single processor
[21:01:00] ivarvong: workmad3: isn't maintaining a bunch of SSE/WS connections pretty much entirely io-bound? seems like having all those threads (for WS/SSE clients) just chilling is a waste. i'm just trying to make sure i understand the pieces here.
[21:01:25] workmad3: ivarvong: I'm saying it's a concern below the level of consideration here ;)
[21:02:19] ivarvong: workmad3: fair enough. thanks for your help. i should probably go write some code. (thanks, toretore, too!)
[21:02:42] workmad3: ivarvong: I'm talking about broader-scale splitting of your traffic into light-weight long-running connections on servers tuned for their use (which could easily use tuned OSes and evented servers) and heavy-weight request-response connections for data transfer (probably using normal rails servers)
[21:02:47] konr_revmob: When should I something on the assets directory and when should I put in public?
[21:02:52] konr_revmob: *put something
[21:03:33] fragamus: any suggestions for a good base app
[21:03:53] DouweM: konr_revmob: with the asset pipeline, there's very little reason to use the public folder anymore
[21:04:20] workmad3: ivarvong: it's also worth noting that I'm talking about ways to scale-out here... chances are your first cut will just be something like spinning up an EM thread in the background to handle long-running connections
[21:04:23] ivarvong: workmad3: yeah, that totally makes sense. i'd guess node/socket.io is a pretty good fit for the former (i used to do a lot of that). right now, looking for keeping things as close together as possible for easier deploy coordination, etc. but your comment is right on, i think.
[21:04:35] konr_revmob: DouweM: cool! I'm not crazy, then :)
[21:04:57] bragkek: fragamus: what do you mean by base app?
[21:05:39] bragkek: fragamus: try creating an image gallery! :)
[21:05:44] workmad3: ivarvong: I just like to take at least some time to consider how to scale-out and distribute a system, so I'm satisfied it's a soluble problem, rather than hit a glass-wall and have to think it through under masses of pressure, strained servers, angry management and upset users :)
[21:05:50] fragamus: I mean this: http://stackoverflow.com/questions/5655071/good-base-app-for-rails-3
[21:06:03] fragamus: but these projects are kind of old
[21:06:21] workmad3: wow, people still use 'base apps'?
[21:06:24] workmad3: </troll> :)
[21:07:01] fragamus: what should I be using instead
[21:07:19] DouweM: `rails new`
[21:07:19] ivarvong: workmad3: a very good point. in my defense, i'm at least using a message queue (sidekiq) to split the request/response stuff apart from the long-lived stuff, right? :)
[21:07:55] workmad3: ivarvong: that's good, that gives you a seam to split them apart on :)
[21:08:36] workmad3: ivarvong: if you make sure you've wrapped the message queue stuff up into your own interface, you can more easily break that out into other (potentially more suitable) message queue systems down the line
[21:09:21] ivarvong: workmad3: that's a great tip! what's your preferred queue?
[21:09:50] workmad3: ivarvong: thinking about it, for example, an AMQP system (like rabbitmq) could be a great fit for handling the routing of updates to clients (it has things like fan-out channels, that will deliver a message to all subscribed queues if I've read the docs correctly)
[21:10:51] nobitanobi: I have a question... I have changed a CNAME of my domain that was pointing to a Heroku app, and make it point to another Heroku app. I have removed the domain from the old app by doing heroku:domains remove..., but now when I visit mydomain, I get "Heroku | No such app"
[21:10:54] workmad3: ivarvong: I don't have a 'preferred' queue, I have a selection of ones I'll consider... ApacheMQ, rabbitmq, sidekiq, DJ, queue_classic
[21:11:23] ivarvong: workmad3: i've read a bit about those, but haven't dabble yet. perhaps it's time. or maybe i'll wait for something to fall over in production? :)
[21:11:49] DouweM: nobitanobi: have you waited for the ttl of the CNAME to pass?
[21:13:00] Apane: Pretty interesting nig-inx for developers: http://carrot.is/coding/nginx_introduction
[21:13:32] DouweM: nig-inx? that's a new one :)
[21:14:23] fragamus: ok so I just found a tool: http://twitter.github.io/bootstrap/
[21:15:06] workmad3: ivarvong: I wouldn't do more than have a quick peruse of them and have an idea of what you'd use them for (what situations they'd fit)
[21:15:16] DouweM: fragamus: bootstrap is awesome, but it's far from a "base app". it's just a bunch of (very useful) CSS and KS
[21:15:24] Apane: workmad3: really? lol
[21:15:25] DouweM: but by all means, use it
[21:15:58] workmad3: Apane: well, unless he has oodles of spare time to play around with different queues in different apps :)
[21:16:30] workmad3: getting an overview, so you have some cached opinions on the next stage is invaluable IMO
[21:16:38] Apane: workmad3: oh ic
[21:17:09] superscott[8]: with Rails4.rc2 - and i want to set a gem to get precompiled as an asset. what's the right way to do this now?
[21:18:05] workmad3: then when something falls over (or starts to creak), you can short-circuit the time taken to fix because you've (potentially) already thought 'oh, it's straining because we're having to re-publish messages to get updates out to all clients... lets use a message queue that lets you fan-out messages for that instead'
[21:18:45] workmad3: Apane: make more sense now? :)
[21:19:18] Apane: workmad3: yea
[21:19:34] philcrissman: superscott[8]: what exactly do you mean?
[21:20:27] superscott[8]: philcrissman: i was using the font-awesome gem, and in rails3 i just added it to the assets group, and it would get precompiled when i raked assets:precompile.
[21:20:31] Apane: philcrissman: re-read it, it makes sense
[21:20:34] Apane: superscott
[21:20:42] Apane: superscott: use this, hang on
[21:21:01] philcrissman: superscott[8]: ah, I see.
[21:21:02] Apane: superscott: add this to your gemfile
[21:21:06] Apane: gem 'rails_log_stdout', github: 'heroku/rails_log_stdout'
[21:21:06] Apane: gem 'rails3_serve_static_assets', github: 'heroku/rails3_serve_static_assets'
[21:21:14] helpa: Apane: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[21:21:23] Apane: woops, but yea thaat works
[21:21:29] Apane: give it a go
[21:21:32] DouweM: also, Apane, those are injected by Heroku automaticallt. you should not need those in your gemfile
[21:21:42] Apane: you do with rails 4
[21:21:45] Apane: and the new heroku toolbelt
[21:21:48] DouweM: :O ah all right, I didn't know that
[21:22:05] DouweM: still not sure what is has to do with philcrissman's problem, but we'll see if it works
[21:22:05] superscott[8]: =/ that seems kinda hacky.
[21:22:20] DouweM: superscott[8]'s problem :)
[21:22:41] philcrissman: Apane: did he say anything about heroku?
[21:22:42] Apane: give it a shot, I spoke with heroku staff about the same compiling error
[21:23:02] DouweM: did superscott[8] post a compiling error?
[21:23:31] superscott[8]: i don't get an error though, it just looks for the .png in the normal assets dir
[21:23:34] Apane: try it -- it sounds hacky and irrelevant but it works
[21:23:43] superscott[8]: yeah i don't doubt it works :)
[21:26:57] stuart_: I would like to access instance variables set in my controller from my .css file? Is this possible?
[21:27:19] DouweM: stuart_: your css file is compiled, so no
[21:27:31] DouweM: stuart_: you can of course include <style> tags in your view
[21:28:44] stuart_: DouweM: Ok, I see. When I google online, I see .css.erc and .css.scss.erb files, do those support it?
[21:29:10] DouweM: they support in-line ruby, but still don't have access to your controller's instance variables because, as I said, they're compiled
[21:29:20] stuart_: Gotcha, thank you!
[21:29:26] DouweM: the ruby isn't evaluated for every request, just once when precompiling
[21:41:58] bjorn_: anyone profecient in activeadmin here
[21:42:09] bjorn_: im losing my cool with this selectable column issue
[21:44:47] superscott[8]: shit never mind, it actually was getting precompiled, but the gem is looking for the non-digest version of the file. fml
[21:46:43] Foxandxss: I love when I deploy and see that my server is too slow and the figure out I forgot a sleep 2 somewhere :P
[21:47:47] DouweM: Foxandxss: lol
[21:52:03] bjorn_: back again
[21:52:10] bjorn_: with questions about activeadmin
[21:54:13] bjorn_: So i have a selectable_column on active admin and it doesnt do the action of selecting all of the records
[21:54:47] bjorn_: slash_nick: like so http://demo.activeadmin.info/admin/customers
[21:55:00] bjorn_: i even copied the source code and for some reason it is not working
[22:02:20] bjorn_: slash_nick: ?
[22:05:20] Apane: Those python guys! when are we going to have something trivial like this for Rails https://zinc.io/
[22:05:33] ryan_turner: slash_work, you around?
[22:17:12] ryan_turner: Ok, so I have a hash that I'd like to use for mass assignment. The model has has_many relationships with 2 other models. Can I just pass the original model a sub-hash and it will create the other two models as members of the parent automatically?
[22:18:02] Apane: https://gist.github.com/
[22:18:09] terrellt: Apane: https://github.com/orangejulius/zinc-ruby Like this?
[22:18:09] brendan6: ryan_turner: if you use accepts_nested_attributes for, yes
[22:18:22] ryan_turner: brendan6, thanks :)
[22:18:39] brendan6: ryan_turner: *accepts_nested_attributes_for
[22:18:45] Apane: terrellt: you scoundrel, ha nice
[22:18:56] terrellt: If it's an API, there is a gem for it.
[22:19:01] terrellt: If there isn't, code fast.
[22:21:45] terrellt: I don't understand the purpose of this place.
[22:21:45] ryan_turner: Does rails support composite primary keys in relations?
[22:23:14] Apane: terrellt: what do you mean
[22:23:30] terrellt: I don't get the benefit to placing orders on amazon via code.
[22:23:30] DouweM: ryan_turner: not that I know of
[22:24:25] Apane: terrellt: Oh ic
[22:24:53] ryan_turner: DouweM, ok. Thank you.
[22:26:02] rhizome: ryan_turner: no
[22:26:22] rhizome: there is an un-maintained gem, if you want to get your hands dirty
[22:26:51] ryan_turner: I'm a newby and am working on a pressing project :) wish I could.
[22:27:05] ryan_turner: Just means I'm going to have to add another column for a unique primary key.
[22:27:07] brendan6: ryan_turner: http://compositekeys.rubyforge.org/
[22:27:33] brendan6: ryan_turner: but I would probably recommend using a separate column like you suggest
[22:28:11] ryan_turner: brendan6, your accepts_nested_attributes_for recommendation works brilliantly. Thanks so much.
[22:28:43] ryan_turner: In fact, I see a few places in my code that I can apply that to which is going to clean it up a good bit
[22:31:28] GreekFreak: when using capistrano, does my remote server need to have access to my local dev machine?
[22:32:29] brendan6: GreekFreak: no
[22:33:01] GreekFreak: brendan6, thank you
[22:43:54] brian___: i know this isn't exactly the right place for this question, but not sure where else to ask/how to ask google. if I'm on git branch master and i make a bunch of changes to several files and then it turns out i want those changes to be part of a new branch, all i have to do is just make the new branch and all those changes will be in that branch and not on master, right?
[22:46:02] brian___: found my answer: http://stackoverflow.com/questions/1394797/move-existing-uncommited-work-to-a-new-branch-in-git sorry thanks
[22:46:33] rhizome: also: #git
[22:47:00] slash_work: brian___: good job, ya found it :)
[22:47:31] brian___: thanks rhizome
[22:56:56] Foxandxss: is there a way to redirect any non valid routes to a static index.html?
[22:57:00] Foxandxss: like this: match '*path', to: 'main#index'
[22:57:06] Foxandxss: but to a public/index.html file
[22:58:37] DouweM: to: redirect("/index.html")
[22:59:33] Foxandxss: thanks DouweM, works like charm
[22:59:53] DouweM: Foxandxss: but are you sure you want to do this?
[23:00:17] DouweM: Foxandxss: non-existing resources should respond with status 404, and you're responding with 3xx
[23:01:05] Foxandxss: yup, but when you use a frontend framework like angular or backbone and you use the html5mode (AKA no hashbang) you need to do that
[23:01:32] Foxandxss: so if you have an angular app in main#index, you need: match '*path', to: 'main#index'
[23:02:02] Foxandxss: so if you go to /foobar and rails doesn't know what /foobar is, it redirects to main#index and tells angular to route to /foobar
[23:02:03] DouweM: in that case a redirecvt won't work though, because you won't preserve the path the JS app needs
[23:02:25] DouweM: what are you doing in public/index.html?
[23:02:41] Foxandxss: is the html file which contains the application
[23:02:46] DouweM: no, don't do that!
[23:02:51] DouweM: use a controller and a view
[23:03:01] DouweM: main#index like you mention
[23:03:01] Foxandxss: no, thank you :P
[23:04:01] rappo: hey guys, I'm from bountysource.com. We ran a contest recently where we asked our users to pick their favorite projects and we'd place bounties on issues for the winning projects. Ruby on Rails came in first, so we have $300 to place on various issues / feature requests. Anyone want to chime in on some issues they'd love to see addressed?
[23:04:06] Foxandxss: because I create my app with a tool called lineman (is like yeoman) so I can create all my angular application, build it and it will create a index.html file and all the static assets
[23:04:13] Foxandxss: so I just need to move that to the /public folder
[23:04:22] Foxandxss: and it works
[23:04:32] DouweM: rappo: that's awesome
[23:05:33] rappo: DouweM: thanks! now the hard part is finding issues worthy of the bounty :P
[23:05:42] rappo: I posted on the mailing list last week, but didn't get any responses
[23:06:26] DouweM: yeah, this is probably a more active place
[23:06:44] rappo: nearly 700 of you... I hope so :)
[23:07:13] rappo: anyone can feel free to link me (in chat or prvmsg) a github issue and I'll put it on the list
[23:07:16] Foxandxss: DouweM: so controller + view, is good for classic apps, but when the app is 90% javascript and the backend is just a REST API, it is good to create independent applications so you can "plug" them where you want to
[23:07:34] Foxandxss: without mixing in it any backend code
[23:07:35] DouweM: Foxandxss: if that's the case, look at rails-api
[23:08:36] Foxandxss: I agree, but will be the same for both, no sprockets
[23:09:18] Foxandxss: so you go like the old days dumping stuff into /public :P
[23:12:54] Foxandxss: DouweM: btw, you were right, the redirect doesn't work
[23:13:00] DouweM: Foxandxss: :)
[23:13:11] Apane: DouweM is right 97% of the time
[23:13:31] slash_work: Foxandxss: U owe DM
[23:13:35] superscott[8]: 97% of the time, he's right 100% of the time.
[23:13:49] banas: anyone know if this thing is usable with ruby-1.9 and rails 3.2? I'm new to rails, would like to setup openid. https://github.com/openid/ruby-openid
[23:13:56] DouweM: Foxandxss: add a basic controller that'll render :file => Rails.root.join("public/index.html") and route to that
[23:13:57] Foxandxss: slash_work: what's DM?
[23:14:04] DouweM: DouweM presumably
[23:14:15] superscott[8]: (direct message)
[23:14:21] DouweM: also that
[23:14:27] Foxandxss: yeah, but doesn't make sense
[23:14:34] webdestroya: wouldnt that be a 'PM' on irc?
[23:14:36] webdestroya: this isnt twitter
[23:14:36] Foxandxss: the direct message I emant
[23:14:53] DouweM: webdestroya: a query, really
[23:14:55] slash_work: Foxandxss: earlier we were talking about how DouweM's name plays tricks on our brains... looks like "Do u owe me?", to me
[23:15:14] superscott[8]: maybe it's a private personal direct message ...
[23:15:25] banas: hi guys. anyone know if this thing is usable with ruby-1.9 and rails 3.2? I'm new to rails, would like to setup openid. https://github.com/openid/ruby-openid
[23:15:39] atal421: does anyone here make their own assets for their apps>
[23:15:57] DouweM: atal421: as opposed to?
[23:15:58] webdestroya: as in design the graphics?
[23:16:14] rushed: banas: you might find these useful http://railscasts.com/episodes?search=openid
[23:16:32] banas: rushed: I checked, but they look old :/
[23:16:35] atal421: DouweM: as apposed to having someone who uses photoshop/design full time
[23:16:40] atal421: webdestroya: yes, graphics
[23:16:44] slash_work: atal421: http://commons.wikimedia.org/wiki/Main_page
[23:16:49] slash_work: oh graphics, not images
[23:16:51] rushed: banas: so is OpenID? :)
[23:17:02] DouweM: atal421: yeah, we have a designer
[23:17:11] atal421: slash_work: same thing to me, graphics == images for now
[23:17:21] slash_work: I search the commons for images to tweak with Gimp
[23:17:30] slash_work: but I don't do it all that often
[23:17:33] banas: ah. I don't know a lot about that. rushed . I'll give it a try!
[23:17:38] kseifried: hey, anyone have contact info for the company doing this? http://www.h-online.com/security/news/item/German-company-will-continue-to-update-Ruby-on-Rails-2-3-1892773.html
[23:18:12] DouweM: kseifried: http://makandra.com/contact
[23:18:18] webdestroya: kseifried: http://makandra.com/contact
[23:18:32] kseifried: right, does anyone have a specific technical contact there for this?
[23:19:01] rushed: kseifried: seriously_just_upgrade_already@localhost ?
[23:19:11] kseifried: rushed, : no, this is for coordinating cves/etc
[23:19:30] webdestroya: why dont you email the contact and ask them...?
[23:19:43] kseifried: webdestroya, : god forbid I should ask here if anyone maybe knows them. sorry
[23:21:39] slash_work: kseifried: no one's mad at you... we just don't have any idea
[23:22:02] kseifried: I freaking hate generic sales/info@. such a waste of time usually :P
[23:22:14] kseifried: plus I've literally never heard of makandra
[23:25:43] kseifried: I worry sometime that the bad guys will do things like this to get early access to vulns and then compromise like 40million servers :P
[23:26:34] slash_work: Just upgrade, right?
[23:26:50] philcrissman: slash_work: +1.
[23:27:05] joelteon: upgrading is easy
[23:27:11] kseifried: slash_work, : go google seifried cve rails
[23:27:29] kseifried: and yeah, we already moved off of rails 2.3 thank goodness
[23:29:51] slash_work: Hey that's you... you're famous :)
[23:30:05] kseifried: yeah.. internet geek famous which I'm pretty sure doesn't count
[23:30:15] fragamus: is this the latest gem install rails --version=4.0.0.rc1
[23:30:28] rushed: kseifried: if they were trying for early access you'd think they'd have a /security ready to go, maybe with a nice proper looking public key :)
[23:31:09] kseifried: slash_work, : if it was up to me there would be mandatory upgrade laws, and you could buy an exception, thus creating an significant economic cost for staying on the same (insecure) software and getting people to upgrade
[23:31:46] kseifried: until we have economic incentives to upgrade, let alone getting rid of the economic penalties of upgrading the world is screwed
[23:31:46] slash_work: kseifried: international law?
[23:31:48] luist: hey guys… it says i need to install: vpim (~> 0.695) ruby
[23:32:11] kseifried: slash_work, : yup. with a possible death penalty for particularily egregious violations
[23:32:12] luist: will bundle install install unwanted stuff besides vpim?
[23:32:34] slash_work: kseifried: George carlin had some interesting ideas on capital punishment
[23:33:01] slash_work: boil them in oil
[23:33:06] rushed: luist: it will install the gems listed in your gemfile along with their dependencies, depending on your expectations that may or may not equal "wanted" :P
[23:33:58] luist: rushed: ooh i got it.. then i have to run it just for the Gemfile that needs vpim
[23:34:26] kseifried: slash_work, : fundamentally it costs money to have processes in place to handle change. treating software like a Ronco rotisserie and ignoring it works until it explodes
[23:34:27] kseifried: such is life
[23:34:36] rushed: luist: you need to be in the project folder you're working with to bundle yes
[23:34:47] luist: yeah it worked.. thanks ^^
[23:35:24] Apane: Some cool folks in #startups I must say.
[23:35:41] kseifried: slash_work: as for capital punishment I'd ,monetize it, gladiatorial combat, pay per view, betting, etc.
[23:36:20] slash_work: kseifried: yeah, you're gonna need to listen to this http://www.youtube.com/watch?v=tJb3aUwcX-Q
[23:36:24] rushed: kseifried: I've seen that movie, they get out and kill you ><
[23:36:29] Apane: Anyone here use Quora? how long would it take to build something like that with a team of 4? (using rails)
[23:36:44] kseifried: rushed, : seriously... door locks. how hard are they to do right? :P
[23:36:45] Apane: hypothetically
[23:36:49] rushed: Apane: everything on the weekend takes a weekend to rebuild, duh
[23:37:11] Apane: So 6 days? lol
[23:37:28] rushed: kseifried: hard! omg, you can wave like… anything with a flashing led at them and them open :(
[23:37:34] kseifried: rushed, : also explosive collars, just make them explode the second someone starts to fiddle with it.
[23:38:02] kseifried: rushed, : why they make explosive collars that aren't sensitive to tampering is beyond me :P
[23:38:39] rushed: collars still run Rails 2 :(
[23:42:20] scyllinice: kseifried: Sounds like Battle Royale (or Hunger Games if you must)
[23:42:40] slash_work: the survivor gets to stay on rails 2 if he wants
[23:42:44] scyllinice: Well, Battle Royale really since you mentioned explosive collars
[23:42:56] kseifried: hunger games was stupid
[23:43:04] kseifried: battle royale was an excellent documentary
[23:43:20] slash_work: "Dip a guy in gravy and lock him in a room with a wolverine that's high on angeldust"
[23:43:41] superscott[8]: kseifried: agreed. i always wondered why Japanese kids were so well behaved
[23:44:58] DouweM: George Carlin is great
[23:45:14] superscott[8]: he's pretty good at being dead.
[23:45:22] joelteon: that's easy though
[23:45:25] kseifried: you know what gets me, Stephen Fry
[23:45:31] kseifried: smart as heck (watch QI)
[23:45:36] kseifried: and funny, insanrly funny
[23:45:38] kseifried: and good at accents
[23:45:44] kseifried: ditto for Hugh Laurie
[23:45:51] superscott[8]: have you heard the stephen fry song?
[23:46:18] superscott[8]: kseifried: http://www.youtube.com/watch?v=RHxXcPC-PcM
[23:48:41] scyllinice: Surprised that hasn't been reuploaded in a 10 hour loop (never understood why people do that)
[23:48:55] fowlduck: In rails 3.2, is there a way to render :inline from a non-controller context with all helper modules and route helpers?
[23:49:20] fowlduck: I don't even want a layout, just to render inline
[23:49:48] DouweM: fowlduck: #render only exists in controller and view, so not sure what you're looking for
[23:49:57] fowlduck: I'm aware it violates MVC, but this is for indexing for searching documentation
[23:49:57] Apane: superscott[8]> loll
[23:50:28] GreekFreak: If I have already performed 'cap deploy' with capistrano, the second time do I do 'cap deploy' again, or do I do 'cap update'
[23:50:36] fowlduck: DouweM: I'm aware, in rails 2.3 I initialized an ActionView::Base and rendered using ERB with view's binding
[23:50:57] fowlduck: DouweM: I'm having a hard time getting things working in rails 3.2, though
[23:51:13] rushed: GreekFreak: deploy, also "cap -T" will give you a list of task descriptions
[23:51:48] rushed: fowlduck: possible that is hard because it's a bad idea? :)
[23:51:53] Apane: RIP James Gandolfini
[23:52:19] DouweM: fowlduck: what's the usecase?
[23:52:23] fowlduck: rushed: it's generally a very bad idea, but for indexing for documentation searching it's a good idea
[23:52:36] GreekFreak: rushed, thank you
[23:53:06] fowlduck: DouweM: we index our documentation on deploy by rendering just the templates in a view context and shipping them off to the search api
[23:53:23] DouweM: fowlduck: okay, that actually sounds kinda reasonable
[23:53:43] fowlduck: 99.999% of the time it's a baaaaaad idea
[23:53:45] terrellt: fowlduck: view_context.render?
[23:53:54] fowlduck: terrellt: tried it to no avail
[23:54:00] fowlduck: I'll try again, though
[23:54:04] terrellt: fowlduck: Are you doing this in a rake task?
[23:54:07] fowlduck: it was 4am last time
[23:54:11] fowlduck: terrellt: affirmative
[23:55:13] fowlduck: ActionView::Template::Error: undefined method `encoding_aware?' for #<Array:0x10d2c1e20>
[23:55:18] scyllinice: fowlduck: Google search turned up https://gist.github.com/tiwakawa/3346691
[23:55:33] fowlduck: scyllinice: I've tried a bunch of variations on this
[23:55:40] terrellt: fowlduck: http://jguimont.com/post/5582583230/how-to-render-a-full-page-template-in-a-rake-task-with This looks promising.
[23:55:42] fowlduck: scyllinice: that's missing helpers
[23:55:50] fowlduck: scyllinice: and url helpers, iirc
[23:56:13] fowlduck: terrellt: ah, that's one I haven't seen
[23:56:16] DouweM: terrellt: ooh, that's not bad
[23:56:19] fowlduck: terrellt: I'll give it a shot
[23:56:30] fowlduck: it's from 2011, though
[23:56:35] fowlduck: which doesn't bode well
[23:56:41] terrellt: fowlduck: https://gist.github.com/juggy/977181 Gist of someone using it in 2013.
[23:56:47] terrellt: Or updating it in 2013, rather.
[23:56:51] fowlduck: nice, thanks
[23:57:30] DouweM: Revisions says "revised 2 years ago"
[23:57:42] DouweM: but still, 2011 is Rails 3, so it's probably closer than any Rails 2 solutions you've found
[23:57:47] DouweM: should be able to get working with minimal effort
[23:58:15] scyllinice: It's pre asset pipeline
[23:58:42] DouweM: true, so config.javascripts_dir etc probably has to go
[23:58:50] DouweM: assets_dir needs to change as well
[23:58:54] fowlduck: DouweM: you'd think that, but I went through more than a few variations. I'm usually really good at spelunking and bending rails to my will
[23:59:18] DouweM: fowlduck: fork it and get it Rails 3.2 ready there, that way other people will be able to make use of i
[23:59:44] fowlduck: yeah, it's missing all the helper modules