« Back to channel list

#RubyOnRails - 08 November 2013

« Back 1 day Forward 1 day »
[00:05:20] zersiax: just a quick question, is anyone available to look over a small rails view with me? Preferably well-versed in Javascript as well? I am running into an issue which I kinda need to fix fast ...but I have no idea whats going wrong ...
[00:05:26] ajustrun: bricker`work: unfortunately that doesnt work
[00:05:56] bricker`work: zersiax: what is the problem?
[00:06:35] zersiax: i'm trying to generate a list of images pulled from Flickr using Javascript when the user enters a bit of text for tags in an input field. problem is ...no images are retrieved. but theres noe rror either
[00:07:03] bricker`work: zersiax: need to see the code
[00:07:39] zersiax: code's here https://dl.dropboxusercontent.com/u/6643494/steptwo.html.erb
[00:08:07] zersiax: just a warning ...the code s kinda ugly
[00:09:17] bricker`work: zersiax: what have you already done to debug? Have you checked if /pictures is being hit fine?
[00:09:38] zersiax: i have tried putting alert statements into the js portion of the code to return the htmlString ...but thats not firing either
[00:10:07] bricker`work: Also, as a side note, you should move that method which writes to the box - it's getting redefined every time someone changes the input, which is silly
[00:10:40] bricker`work: zersiax: put an alert in the success callback first, to make sure you're getting success from the server
[00:11:58] zersiax: i thought of that but I wouldn't know where to put that and what to echo back in this case. my javascript isn't very good just yet
[00:14:37] bricker`work: zersiax: like this: https://gist.github.com/bricker/7364169
[00:15:16] bricker`work: zersiax: also, look at your rails log to see if the /pictures path is every getting received
[00:19:35] zersiax: it appears that is not firing either
[00:20:09] bricker`work: zersiax: okay, so then you might have a problem in your pictures controller
[00:25:13] Apane: what do you think of this code guys? https://gist.github.com/anonymous/f6262d288f00c9b7d4f2
[00:26:45] smathy: Apane, I think you get my award for zaniest question of the day.
[00:27:01] zersiax: i already see that that URL is faulty, it should be submittedpictures/show ...but that still won't fire the alert. mind if I share that controller with you as well?
[00:27:57] smathy: Apane, what do you think of this code? -> join {([%[ha]] * join) . join %[ ][0]}[5]
[00:28:36] Apane: it's one line smathy
[00:28:51] smathy: Yes it is.
[00:42:12] Radar: Apane: worst. code. ever.
[00:44:00] bpgoldsb: Really odd problem... On Rails 4, I have added a boolean column named force_pass_reset to my users model. Only have one user. User.first prints the model saying force_pass_reset is true. But user.force_pass_reset returns nil (not no method). Any ideas wtf is going on?
[00:44:45] Radar: bpgoldsb: Why would it raise NoMethodError?
[00:44:48] helpa: bpgoldsb: 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.
[00:44:48] Radar: bpgoldsb: !code
[00:44:57] Radar: bpgoldsb: User.first.method(:force_pass_reset).source_location
[00:46:19] nobitanobi: I have a query like this: Image.where(:conditions => {:page_id => @page.id}).order(score: :desc).first(3) -- How would I ensure in the conditions that ':score' > 0 ?
[00:46:56] Radar: nobitanobi: Why are you using :conditions => inside of where?
[00:46:59] Radar: :conditions is OLLDDDDD syntax
[00:47:21] Radar: Image.where(:page_id => @page.id).where("score > 0")
[00:47:22] nobitanobi: yes yes, sorry, let me rewrite it. I was playing with it
[00:47:36] nobitanobi: Radar, you could put both those conditions in a hash right?
[00:47:51] Radar: nobitanobi: nope.
[00:48:40] nobitanobi: chaining for the win then
[00:49:55] Apane: how do i create an array of new users? i.e. [{ name: 'jack', age: 10},..., {name: 'joe', age: 14}
[00:51:25] smathy: Apane, assuming a bunch of things: that_array.each{|e| User.create! e}
[00:51:34] Radar: Apane: Did you try passing that array to User.create?
[00:52:06] Apane: Radar, no - but I suppose I should :)
[00:52:07] smathy: Heh, I forgot about that, Radar FTW
[01:29:04] rhizome: be nice if bundler went through all dependencies before crapping out
[01:32:50] Radar: <obligitary "patches welcome">
[01:33:31] willmarshall: Hey guys! I'm having this issue including url_helpers into a Haml filter: http://stackoverflow.com/questions/10028791/accessing-route-helpers-in-rails-3-2
[01:34:22] willmarshall: The fix suggested (running my paths manually as Rails.application.routes.url_helpers) partially works, but need full URLs not paths, and the object_url helpers fail, missing the default host parameter
[01:36:32] Radar: willmarshall: So set the default host parameter :P
[01:36:41] Radar: ActionController::Base.default_url_options = { host: "foobar.com" }
[01:39:02] Apane: Given [1, 3, 5, 8], how would you extract and store in variables the 1st, 3rd and 4th element of the array?
[01:40:39] Radar: <troll>There is no 4th element in the array</troll>
[01:40:57] lethjakm1: that's true.
[01:41:34] Radar: Apane: Store them how?
[01:42:06] Apane: your first answer was correct.
[01:46:35] rhizome: interview q
[02:00:01] Zesty: Does anyone know how I add custom metadata to S3 via carrierwave before the file uploads?
[02:06:40] sevenseacat: note to self - don't run `gem cleanup` when using an old ruby that you have problems installing gems on due to ancient dependency issues
[02:08:49] lethjakm1: sevenseacat: oh god.
[02:08:55] lethjakm1: let me guess, everything broke.
[02:09:31] sevenseacat: it installed a whole buncha gems that i am now trying to reinstall
[02:10:56] lethjakman: sevenseacat: are any of them no longer available?
[02:11:01] lethjakman: that's what I'd worry about.
[02:11:22] sevenseacat: just dependency nightmares with shit like capybara-webkit
[02:11:39] lethjakman: eww. can your Gemfile not handle it?
[02:11:54] sevenseacat: no not issues like that
[02:11:58] PPH: Is it possible to create a model that would not interact with a database? I would like to implement my own query methods like find.all that would query an api instead of a database.
[02:12:06] sevenseacat: issues that i cant get the older versions of the gems to install properly
[02:12:54] lethjakman: PPH: just don't use ActiveRecord. or you could overwrite them too.
[02:13:04] lethjakman: write your own base model.
[02:13:17] DanBoy: do people still use webrat vs capybara?
[02:14:00] sevenseacat: i dont think anyone still uses webrat
[02:14:06] lethjakman: DanBoy: I use capybara with functional tests in Rspec.
[02:14:11] PPH: lethjakman: well can I overwrite only the methods I want to use or I must overwrite them all?
[02:14:24] DanBoy: lethjakman, what do you use for integration tests?
[02:14:34] lethjakman: PPH: only the ones you want to use. to me it sounds like you'd actually want to write your own base model though.
[02:15:34] PPH: lethjakman: like ActiveRecords?
[02:15:34] lethjakman: DanBoy: sorry I meant feature specs.
[02:15:43] lethjakman: PPH: yeah. basically write your own basic version of activerecord.
[02:15:47] DanBoy: oh so no cucumber than right?
[02:15:57] lethjakman: DanBoy: no...it's ugly.
[02:16:13] PPH: lethjakman: Aight I'll look into it thank you
[02:16:16] lethjakman: DanBoy: I really do like RSpec though, easy syntax and it's very well supported everywhere. that's my personal recommendation.
[02:16:23] DanBoy: ya rspec is great
[02:16:36] lethjakman: DanBoy: how do you feel about cucumber?
[02:16:43] sevenseacat: sigh at my stupidity
[02:17:05] DanBoy: honestly i like it, but even the author of the book im reading now doesn't use it anymore
[02:17:24] lethjakman: DanBoy: really? I've been seeing tons of people using it. what book are you reading?
[02:17:29] DanBoy: basically if you never have clients reading gherkin then theres no point
[02:17:35] DanBoy: rails 3 in action
[02:17:48] lethjakman: ahhh they're coming out with a new one.
[02:17:56] helpa: Rails 4 in Action - http://manning.com/bigg2 - An excellent book combining Rails and TDD/BDD development. Written by Steve Klabnik, Ryan Bigg, Yehuda Katz
[02:18:10] lethjakman: I think backend programmers tend nto to like cucumber
[02:18:15] lethjakman: I think frontend guys tend to like it though.
[02:18:17] DanBoy: in rails 3 in action theres heavy use of cucumber
[02:18:24] sevenseacat: i think most programmers tend to not like cucumber
[02:18:35] erichmenge: I like cucumber on my salad.
[02:18:39] erichmenge: But that's about it.
[02:18:45] lethjakman: sevenseacat: yeah? I've seen it pretty widely used on the internet. it looked like cucumber was used more than rspec. am I wrong?
[02:18:49] DanBoy: its ok, but its not really that logical i guess unless you have non programmers reading the feature files
[02:18:52] sevenseacat: lethjakman: very wrong.
[02:18:55] lethjakman: sevenseacat: thank god.
[02:19:04] DanBoy: i like cucumber
[02:19:07] DanBoy: so its like
[02:19:20] DanBoy: rspec is for models and controllers mainly and then features with cucumber
[02:19:22] DanBoy: i like it
[02:19:31] DanBoy: i dunno if i'll use it again or not
[02:19:40] sevenseacat: i prefer just using rspec for the lot. easier to read and less fluff.
[02:19:42] erichmenge: http://www.whfoods.com/genpage.php?tname=foodspice&dbid=42
[02:20:09] DanBoy: at the same time though cucumber will document the application really well
[02:20:15] DanBoy: even though rspec is also easy to read
[02:20:24] lethjakman: erichmenge: -_-
[02:20:29] erichmenge: lethjakman: wut?
[02:20:39] sevenseacat: if by documentation you mean stilted language that doesnt express what the code actually does, sure
[02:21:08] sevenseacat: DanBoy: trust us, we've all been through this 'cucumber is awsum' phase
[02:21:16] lethjakman: I think I would agree with that....it'san interesting idea, but I don't think it's possible to use human language to actually test...it's not quite logical enough
[02:21:28] diegoviola: i never liked that cucumber thing
[02:21:38] DanBoy: but i mean what are you supposed to do with clients that want to see features if you just use rspec
[02:21:39] lethjakman: I never did. I just looked at it and was like "wow...this is dumb"
[02:21:49] lethjakman: pretty website though.
[02:21:50] sevenseacat: you have clients that want to see features?
[02:21:56] DanBoy: i brought that up to a friend and he said on 2 of his projects the clients wanted cucumber
[02:22:00] sevenseacat: as in, writte cucumber features?
[02:22:05] DanBoy: and actually read the feature s
[02:22:16] sevenseacat: you can make the features say anything though, thats what doesnt make sense
[02:22:26] sevenseacat: i can write a feature that says i built facebook
[02:23:08] lethjakman: yeah....that's clients though.
[02:24:13] bricker: DanBoy: 1. Use something like Trello. *They* can then write the features, and you can implement/test them however you want
[02:24:25] bricker: DanBoy: OR, you can use RSpec's BDD syntax
[02:24:34] bricker: Capybara, I mean
[02:24:39] bricker: Capybara + Rspec
[02:24:51] DanBoy: never heard of Trello
[02:24:52] DanBoy: lemme check it out
[02:26:31] DanBoy: maybe im missing something but i can't find any info on it
[02:26:33] sevenseacat: hooray, i haxed the gemspec for capybara webkit and got it installed
[02:26:36] DanBoy: i see blank pages mostly
[02:26:40] Radar: DanBoy: http://trello.com
[02:26:47] bricker: DanBoy: PivotalTracker would also work
[02:27:10] sevenseacat: i use trello for my own jottings
[02:28:10] bricker: We use that, it's good. They add stories, you implement/test them, and then you mark them as "Finished". Then when they've had a change to review the feature, they can accept or reject it, leave comments, whatever. Good workflow. I also use it for leaving reminders to myself.
[02:34:28] Apane: How would you organize navigation tabs in a large app? not sure about this one
[02:36:05] bricker: that is quite a vague question
[02:36:14] Radar: In alphabetical order or based on length of the words contained within the labels for those tabs.
[02:36:28] erichmenge: Apane: Radar is correct.
[02:36:43] Radar: Apane: You really need to phrase your questions better. Explain the *why* behind the questions, please.
[02:37:08] sevenseacat: let me guess, more interview questions
[02:37:50] Apane: sevenseacat, no just a simple excercise
[02:37:57] Radar: Apane: Given to you by *who*?
[02:38:47] erichmenge: Apane: so your employer is testing you?
[02:38:50] Radar: +q *!*(@CPE7cb21bc298cf-CM7cb21bc298cc.cpe.net.cable.rogers.com
[02:38:52] Radar: -q *!*(@CPE7cb21bc298cf-CM7cb21bc298cc.cpe.net.cable.rogers.com
[02:38:56] Radar: +q *!*@CPE7cb21bc298cf-CM7cb21bc298cc.cpe.net.cable.rogers.com
[02:39:12] Radar: 1 week ban for a) asking interview questions and b) denying that you were asking interview questions.
[02:39:19] Radar: That's cheating and you're a scumbag for doing that.
[02:39:39] erichmenge: Radar: I would like to know why if he's already hired his employer is giving him tests.
[02:39:47] erichmenge: There seems like there could be a good story here.
[02:40:20] DanBoy: interview/.
[02:40:43] erichmenge: Well, he said it wasn't an interview... I guess he could be lying.
[02:40:59] erichmenge: But I find the prospect of him being interviewed to keep his job more fun.
[02:41:01] Radar: http://logs.ryanbigg.com/RubyOnRails?date=2013-11-07#1429868
[02:41:20] macsplean: Hey y'all, wondering if someone can help me with setting up some front end stuff in my app, im quite a noob
[02:41:35] erichmenge: Radar: That's wonderful.
[02:41:40] Radar: erichmenge: ikr
[02:41:53] Radar: macsplean: What do you mean by "front end stuff"?
[02:42:25] macsplean: well i am using bootstrap and there is some issues getting that working right, and also I'm having trouble with the asset pipeline
[02:43:01] Radar: https://twitter.com/LeapFM/status/398641535907934208
[02:43:04] macsplean: bootstrap isn't integrating right and assets arent pipelining
[02:43:06] Radar: Further sighing taking place.
[02:43:14] helpa: macsplean: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[02:43:14] Radar: macsplean: !debug
[02:43:21] Radar: macsplean: Particularly point #2.
[02:43:35] Radar: (p.s. not sighing at you, sighing at Apane)
[02:43:56] erichmenge: Radar: That company sounds all kinds of fun
[02:44:06] sevenseacat: lemme guess, PM spam?
[02:44:19] macsplean: haha, you've done this before, i see.
[02:44:29] Radar: macsplean: once or twice :)
[02:44:41] erichmenge: I do exercises at my company too. It's called work.
[02:45:05] DanBoy: string.succ ?
[02:45:10] Radar: macsplean: I'm even writing a book on debugging.
[02:45:11] helpa: macsplean: Debugging Ruby, a new ebook written by Ryan Bigg. https://leanpub.com/debuggingruby
[02:45:11] Radar: macsplean: !dr
[02:45:21] Radar: And you've given me another idea :D
[02:45:44] sevenseacat: 22 readers now!
[02:46:28] sevenseacat: thats not bad, a couple hundred bucks in your pocket
[02:46:56] Radar: 8.50 * 22
[02:47:09] Radar: Paid for the copy of Pixelmator that I bought to make the covet
[02:47:16] erichmenge: Pixelmator is good stuff.
[02:47:28] sevenseacat: now get back to work *cracks whip*
[02:47:31] Radar: Personally, I like the way it didn't crash when I tried saving the file.
[02:47:44] erichmenge: That's definitely a plus.
[02:49:22] DanBoy: when i do lets say
[02:49:36] erichmenge: so Radar you did that cover yourself? It looks really professional.
[02:49:46] DanBoy: link_to "Edit ticket", [:edit,@project,@ticket]
[02:49:57] DanBoy: what does rails do to form the route for this link
[02:50:07] sevenseacat: man i hate that syntax for routes
[02:50:16] sevenseacat: it'll pluck the edit_project_ticket_path
[02:50:26] Radar: erichmenge: It's two bits of text, one of them has an underline and a shape of two intersecting lines :P
[02:50:49] DanBoy: its a bit confusing for me to read that
[02:50:59] Radar: DanBoy: http://ryanbigg.com/2012/03/polymorphic-routes/
[02:51:08] Radar: And another idea :)
[02:51:29] sevenseacat: this is going to be an awesome book
[02:51:31] bricker: Debugging Rubby eh
[02:51:56] Radar: bricker: Yes! :D
[02:52:11] bricker: Radar, will the book also talk about debugging Rails apps, or is it strictly Ruby?
[02:52:20] Radar: bricker: Both Ruby and Rails.
[02:52:40] Radar: I've already got 1 Rails example mostly written and another 6 planned
[02:52:51] Radar: I've only got 2 Ruby examples so far.
[02:53:36] sevenseacat: i can think of one good example, to do with load_and_authorize resource in cancan that seems to trip people up a lot
[02:53:39] bricker: You should see if you could get some NewRelic sponsorship *cough*
[02:54:46] bricker: They've been on a mad hunt for ad space lately, I bet they would jump at the offer, but it wouldn't be shameless, because NewRelic is actually awesome and useful for debugging rails apps
[02:54:57] bricker: especially if you actually use it
[02:55:14] bricker: ("you" meaning you, Ryan Bigg)
[02:56:05] Radar: I don't actually have any recent experience with New Relic
[02:56:17] Radar: I used it back in 2009/2010 for some things, but since then I've been able to figure things out without it.
[02:56:27] Radar: What kind of features do you think are good about it?
[02:57:09] erichmenge: Radar: davidcelis works there, that's the only feature I need.
[02:57:18] bricker: The error reporting plus hooks into your notification service of choice (we use PagerDuty) alone are worth the money.
[02:57:50] Radar: bricker: Could be good to mention that after all the examples.
[02:58:21] bricker: Radar: When any of our sites goes down, I know within 10 seconds thanks to NewRelic, and can usually identify the problem within another 10. Their Ruby client is easy to use too, with nice documentation and frequent updates.
[02:58:54] jrobeson: PPH, did somebody suggest activemodel to you? but there's actually something like active model built for api querying but i don't remember the name
[02:58:56] bricker: Aside from all that, they give you a really good look into the performance of your app (although Yehuda Katz says otherwise, which is why he started a competing service)
[02:59:20] Radar: skylight.io
[02:59:35] sevenseacat: havent heard of that
[03:00:08] bricker: He and his business partner (forget his name) were on the thoughbot podcast talking about it (and ember), worth a listen if you have an hour or so
[03:00:22] sevenseacat: i probably have that podcast saved here somewhere
[03:00:29] Radar: Carl Lerche
[03:00:35] Radar: and/or Tom Dale
[03:00:40] bricker: It was Tom
[03:01:44] sevenseacat: ACTION listens
[03:04:05] Radar: lmao if you argue in PM after a ban
[03:04:33] lethjakman: bricker: huh...that looks kinda cool. is the performance pretty good?
[03:06:03] bricker: lethjakman: of what?
[03:07:04] lethjakman: bricker: new Relic's monitering capabilities. like the CPU usage and such.
[03:07:25] lethjakman: seems like it could get kindof intense with everything it monitors.
[03:08:10] bricker: lethjakman: the process that runs on the server is very small, just phones home and keeps track of the server basics
[03:08:10] jrobeson: that's why people spend the big bucks with it
[03:08:30] bricker: lethjakman: the overhead of the ruby client on your app is negligible
[03:08:41] lethjakman: fair enough.
[03:08:55] bricker: But the little overhead there is is absolutely worth it
[03:09:07] lethjakman: jrobeson: this is coming from an ex magento developer. I know people will spend big bucks on crappy software.
[03:09:35] lethjakman: I think I'll be using that....the comfort of knowing everything is great.
[03:10:05] bricker: It even has built-in support for monitoring resque jobs, which is great because problems in that area usually go undetected unless you've put forth a real effort to monitor it yourself (with after_failure hooks sending out e-mails and stuff), or if you keep an eye on resque's wonky sinatra app which barely works
[03:11:06] DanBoy: Radar, thats a good post
[03:11:12] lethjakman: bricker: wow, that's brilliant.
[03:11:13] DanBoy: completely explained it
[03:11:18] lethjakman: is the documentation pretty decent?
[03:11:32] Radar: DanBoy: :D
[03:11:39] DanBoy: just because sometimes rails "magic" is not good for me
[03:11:43] DanBoy: i want to know wtf is going on
[03:11:52] bricker: lethjakman: it's pretty good, not perfect but good
[03:12:16] bricker: lethjakman: but the ruby client is on github so if you get lost you can always dive in
[03:13:53] lethjakman: bricker: definitely a plus. just starred it, when we get ready to deploy I'll make sure we get it. thank you :)
[03:14:13] sevenseacat: i have to get back to ember stuff
[03:14:40] lethjakman: sevenseacat: do you like ember?
[03:14:47] Radar: If I was going to re-write Spree from scratch I probably would write it as a REST API with Ember bolted on the front.
[03:15:03] sevenseacat: lethjakman: it seems to be the best javascript mvc framework.
[03:15:04] lethjakman: Radar: good to know.
[03:15:13] lethjakman: Radar: how big of a part did you have in spree btw?
[03:15:27] lethjakman: really even over the google one?
[03:15:33] Radar: lethjakman: "the google one"?
[03:15:36] sevenseacat: Radar: i await your next book 'rewriting large applications from scratch'
[03:15:39] lethjakman: trying to remember it.
[03:15:51] Radar: I've got 3135/10422 commits in Spree.
[03:16:01] Radar: sevenseacat:
[03:16:04] lethjakman: so not bad. lol
[03:16:24] Radar: Pretty much bang on 30% of all commits are from me
[03:16:33] Radar: sevenseacat: "rewriting Spree" would be a fun book to write :D
[03:16:44] sevenseacat: ACTION has the job of maintaining a large bug-riddled rails 3.0 app
[03:17:04] lethjakman: sevenseacat: lol. ouch. what app?
[03:17:22] sevenseacat: oooh one of these guys doesnt like turbolinks
[03:17:31] sevenseacat: lethjakman: just a web app for a client
[03:19:52] jrobeson: i like the service based approach for angular ..
[03:19:58] jrobeson: but i don't really like the ng junk..
[03:20:33] sevenseacat: angular seems to be the next best option.
[03:21:27] jrobeson: i'm having trouble picking
[03:21:33] jrobeson: ember might be too railsy for me
[03:21:53] jrobeson: if i wanted railsy .. http://joosy.ws/
[03:22:41] sevenseacat: railsy is a good thing to me :P
[03:23:44] jrobeson: does anybody know what's coming for rails 4.1 ?
[03:28:37] sevenseacat: ooh now they're panning newrelic
[03:29:36] macsplean: radar: https://gist.github.com/MaxPleaner/7365878
[03:30:01] Radar: may as well have uploaded the whole application to GH :)
[03:30:23] macsplean: i know lol i should have done that (not really laughing)
[03:30:44] Radar: macsplean: What do you see when you go to localhost:3000/assets/application.css? Do you see the bootstrap styles in that file?
[03:31:15] macsplean: radar: yeah
[03:31:40] Radar: So what's happening then? The Gist doesn't include any screenshots
[03:31:50] macsplean: actually it does it just mixed up the order
[03:31:58] macsplean: check for the imgur link
[03:32:39] Radar: Can you put the application on GitHub please? I would like to clone it and fiddle around with it.
[03:33:41] macsplean: shit brain fart on git hub
[03:33:42] macsplean: gimme a sec
[03:35:35] macsplean: radar: https://github.com/MaxPleaner/tryme
[03:36:45] sevenseacat: this app has about a billion associations that dont have a dependent option specified, so records get left in stupid states
[03:36:59] Radar: macsplean: so what do you expect to see?
[03:37:19] macsplean: http://imgur.com/SjWLGK5,C5XdIjw#0 "second image"
[03:38:07] Radar: macsplean: I moved the import for bootstrap to the bottom of application.css and it fixed it.
[03:39:34] macsplean: radar: it's still not doing the Bootstrap Javascript effect where the text pops out
[03:40:14] Radar: macsplean: probably the same problem here: https://github.com/MaxPleaner/tryme/blob/master/app/assets/javascripts/application.js
[03:40:22] Radar: macsplean: move the bootstrap require to after the other ones
[03:40:26] Radar: And maybe before require_tree
[03:41:14] macsplean: Radar: it's doing this weird thing where it flashes the popout for just an instance
[03:41:23] Radar: macsplean: I dont' know what could be causing that.
[03:41:35] Radar: My fort?? is Ruby/Rails, not JS and CSS libraries written by other people :)
[03:42:10] macsplean: well thanks for what you helped me wish
[03:49:15] PPH: Hi, anyone know if anything exist that would allow to use cpanel api as a model?
[03:51:14] PPH: I found lumberg, which allow to interact with cpanel api in ruby but a model would fell more appropriate.
[03:51:32] sevenseacat: cpanel as a model?
[03:51:44] tubbo: lol "lumberg"? haha
[03:51:46] sevenseacat: CPanel.find(5)? >_>
[03:51:58] Radar: anyone know if anything exist that would allow me to blow a gigantic hole in my foot?
[03:52:15] Radar: CPanel is bad. There be dragons (and worse things)
[03:52:30] tubbo: PPH: a model is just a concept, it doesn't have to be descended from ActiveRecord::Base
[03:53:31] jrobeson: PPH, you an look into activemodel instead of activerecord
[03:53:39] jrobeson: i mentioned that earlier
[03:54:45] PPH: jrobeson: ah I missed that one I'll have a look :)
[03:57:32] PPH: jrobeson: yeah I think that's exactly what I was looking for... Thank you
[03:57:52] willmarshall: In helper tests, stubbing out a helper doesn't seem to work. I've got a current_order_cycle helper I want to stub, but helper.stub(:current_order_cycle) doesn't block the call
[03:57:54] willmarshall: How should this work?
[03:57:55] jrobeson: PPH, there's actually something live activemodel just for apis, but i don't remember the name
[03:59:29] lgarvey: ActiveResource I think you're referring to.
[04:01:20] helpa: willmarshall: 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.
[04:01:20] Radar: willmarshall: !code
[04:06:15] willmarshall: Radar. Hah. Fair. Gist! https://gist.github.com/willrjmarshall/7366130
[04:06:30] sevenseacat: i like gists.
[04:06:45] willmarshall: Issue is, it continues to call current_order_cycle in spite of the stub
[04:06:58] Radar: Seems legit to me...
[04:07:05] sevenseacat: how have you verified it's still calling it?
[04:07:19] Radar: puts helper.method(:current_order_cycle).source_location before the pickup_time call... what does that return?
[04:07:58] seoNinjaWarrior: I keep getting this "We're sorry, but something went wrong." and nothing is getting logged to log/production. I'm using apache + phusion passenger and here's my virtual host config : http://pastebin.com/7iznk7BH - If I use webbrick (RAILS_ENV=production rails s) everything works just fine with no errors... I'm hoping someone can help. I'm at like 2 hours googling with no success :/
[04:08:22] Radar: Still love that auto responder.
[04:09:30] willmarshall: What you'd expect: "/Users/willmarshall/Projects/openfoodweb/app/helpers/order_cycles_helper.rb 2"
[04:10:58] jrobeson: lgarvey, cool thanks
[04:11:08] willmarshall: Ah. It returns "/Users/willmarshall/.rvm/gems/ruby-1.9.3-p392@openfoodnetwork/gems/rspec-mocks-2.14.2/lib/rspec/mocks/method_double.rb" when I do it after the mock
[04:11:38] Radar: So therefore I think it should be workgin still.
[04:11:45] Radar: The stub should be working.
[04:12:05] sevenseacat: so.... to my question
[04:12:10] willmarshall: OK. So I'm not crazy, hmm
[04:12:26] Technodrome: how much of the apps you guys make does your app follow a pretty straight forward CRUD work flow, 70 percent?
[04:12:33] Technodrome: I know that's a wide question, but just curious of the estimate
[04:12:36] sevenseacat: Technodrome: most of it.
[04:13:09] Technodrome: by crud workflow, i mean , not having to do anything too crazy outside / the norm
[04:13:19] Technodrome: of course not every controller will need every CRUD method
[04:13:20] Radar: Spree is all about the crazy.
[04:13:33] Radar: See http://ryanbigg.com/2013/09/order-adjustments/ for instance
[04:13:46] sevenseacat: glad it's you and not me then!
[04:14:51] willmarshall: Spree is pretty fun thus far
[04:14:57] Technodrome: Spree hard to work with or something?
[04:15:15] Radar: Technodrome: I work full-time on Spree and it's community. I'm the community manager for Spree Commerce.
[04:15:28] Radar: Technodrome: Spree is just a midlly complex gem
[04:15:54] Technodrome: shopping carrts are a hard business, everyone one of them that has a set process and you want to change it, expect hell :)
[04:16:02] willmarshall: To be fair, Radar is unusually badass
[04:16:07] lgarvey: I'd argue that if you're not doing CRUD with basic resources for most things, you're doing it wrong for a large majority of apps. Libraries (like spree) are a whole other game though.
[04:16:36] Radar: Technodrome: we support changing the cart :)
[04:17:32] Radar: o/ jrobeson
[04:17:45] jrobeson: ACTION give Radar a gold star
[04:17:50] jrobeson: that is the correct response!
[04:17:56] jrobeson: \o -> o/ ping/pong
[04:25:57] sevenseacat: ACTION shrugs and goes back to work
[05:04:39] PPH: So, if I include ActiveModel::Model in my Account class and I want to do Account.find to fetch some accounts from a remote api, I only need to implement this method in my model?
[05:05:14] Radar: PPH: Yes you will need to implement the logic of finding the Accounts in your model.
[05:06:45] PPH: Radar: Awesome and I can use ActiveModel's validation module to validate my data before I call something like Account.save
[05:07:16] PPH: Radar: Really cool. I love Rails :) Thank you
[05:14:48] PPH: Anyone know how class methods like Person.find.all are created? Is this some nested methods or find is a namespace created by a module or something like that?
[05:16:19] DanBoy: find.all should be default
[05:17:56] Radar: PPH: Those methods come from ActiveRecord. ActiveModel is different. You will need to define your own methods.
[05:18:30] DanBoy: Active record will create methods based on table attributes right?
[05:18:33] DanBoy: like find_by_email
[05:22:09] PPH: Radar: yes i know i'd like to implement a find.all method but i don't know how to create this kind of methods.. Is this simple as doing def find.all ... end?
[05:22:19] tubbo: well you can't do find.all
[05:22:28] tubbo: you can do def find_all though
[05:22:52] tubbo: at any rate, the AR .find() method just returns a single object anyway
[05:23:28] PPH: tubbo: Aight I'll stick with find_all for now thank you
[05:25:22] tubbo: Radar: is it possible to just use spree_api without the rest of spree?
[05:26:18] tubbo: last time i tried it i remember it being pretty complicated
[05:27:55] Radar: tubbo: It's actually quite easy. Just add spree_core and spree_api to your Gemfile and go.
[05:28:12] tubbo: by "it" i mean getting spree going
[05:28:27] Radar: tubbo: what was complicated about it?
[05:29:11] tubbo: well this was a few years ago mind you, but i remember having to generate a bunch of migrations and then run them
[05:29:17] tubbo: then do some other generator things
[05:29:23] tubbo: now it seems like it's just 1 command
[05:29:58] Radar: Yeah, add the stuff to your Gemfile and rake railties:install:migrations && rake db:migrate
[05:30:02] PPH: Bleh I'm stupid Person.find.all does not exists anyway... the method is Person.all
[05:30:43] tubbo: Radar: i might give spree_api a shot...i already created this ordering system with Stripe though :D
[05:30:59] Radar: PPH: You do 'def self.all' btw
[05:31:04] Radar: Because it's a class method
[05:31:17] tubbo: spree has more features, though. right now the store doesn't really support "stock" since it's digital downloads.
[05:31:33] PPH: Radar: lol thanks I was about to do def all ....
[05:31:37] tubbo: so if i just used spree i'd get that for free
[05:35:33] tubbo: willmarshall: i thought you were a python dev :P
[05:54:09] krz: content_for doesnt get cached?
[05:54:11] davidcelis: bricker`work, Radar: since yehuda's talk, we released a feature that is _the_ reason he said we were inadequate (we were working on it before his talk) :P
[05:54:35] Radar: davidcelis: which feature was that? I didn't listen to his talk.
[05:54:39] Radar: krz: nothing is cached automatically.
[05:54:52] davidcelis: he was basically hating on averages, saying percentiles gives you a better picture
[05:55:02] davidcelis: and he's right for a lot of cases
[05:55:09] davidcelis: so we do percentiles and histograms now
[05:55:52] sevenseacat: yeah that was pretty much the entirety of his argument, that averages were pointless
[05:56:04] sevenseacat: oh and polyglots arent as good as a single focus
[05:56:16] davidcelis: he quoted one of our principal engineers in his talk saying averages weren't helpful; he was kind of a dick about it :\
[05:56:27] bpgoldsb: I'm looking to run a small rails app that will serve as an admin tool for a server. It will never be heavily used in terms of hits/second or concurrency. What standalone web server would you recommend running it under? Unicorn? Mongrel? Puma? I've always deployed apps under passenger, but in this case, I want the least amount of dependencies as possible. So no apache/nginx.
[05:56:49] sevenseacat: he hated on heroku a lot for the whole not-supporting-sqlite thing as well
[05:56:49] davidcelis: bpgoldsb: i've found puma very easy to deploy
[05:56:58] krz: Radar: i kkonw that. i was referring to fragment caching
[05:57:07] sevenseacat: krz: well we're not mindreaders
[05:57:09] davidcelis: do people even still use mongrel
[05:57:14] davidcelis: is mongrel even a thing anymore
[05:57:22] bpgoldsb: Probably not, it was just in the back of my head from my old Puppet days
[05:57:23] krz: sevenseacat: surely you would know that anything doesnt get cached magically
[05:57:31] sevenseacat: well you apparently didnt
[05:57:35] davidcelis: the latest stable release of mongrel is 5 years old
[05:57:50] davidcelis: its successor is thin
[05:57:52] bpgoldsb: The app runs fine under Webrick even, so it really comes down to what's easy, lightweight, and stable.
[05:58:00] davidcelis: bpgoldsb: puma or thin.
[05:58:04] davidcelis: both are good
[05:58:12] sevenseacat: ACTION punches basecamp for doing really shit caching
[05:58:34] bpgoldsb: davidcelis: You're more experienced with them than me. Which would you pick?
[05:58:39] sevenseacat: i ake updates and i cant freaking see them anywhere
[05:58:56] davidcelis: bpgoldsb: there are a couple apps i've developed that i use thin locally
[05:59:02] davidcelis: i almost always default to puma nowadays
[05:59:18] bpgoldsb: Roger. I appreciate the input!
[06:00:34] epitron: is there a way to make a wildcard route, like "/proxy/*", but which doesn't assign the * to a param?
[06:00:41] willmarshall: tubbo - what? Why?
[06:02:02] tubbo: willmarshall: wait are you this guy? https://github.com/willrjmarshall
[06:02:35] epitron: or, like, is there a way to separate out the query string (?var=x) from the params assigned by the route?
[06:02:38] drim: how can I use Fabrication to populate data in my dev env ?
[06:02:50] sevenseacat: drim: same way you would in your test env
[06:02:59] sevenseacat: or any other env
[06:03:22] drim: sevenseacat: im starting with rails. I have my spec/fabricators/xxxx.rb file. How can I load it ?
[06:03:33] epitron: ah, nice.. request.query_parameters
[06:03:39] drim: rake db:populate?
[06:04:07] willmarshall: tubbo. Yes... that's my horrible github account
[06:04:16] sevenseacat: drim: you dont need to
[06:04:22] willmarshall: tubbo - dare I ask how you know?
[06:04:37] tubbo: willmarshall: well until today, i didn't notice the ruby software at the bottom. i know because i use your ableton dj template.
[06:04:38] Radar: drim: You should put it in a common location, such as lib/fabricators, if you want to load it in both environments.
[06:04:50] tubbo: and the APC40 scripts
[06:04:53] willmarshall: tubbo - oh right. Yeah, I only write Python for kicks
[06:04:57] willmarshall: I know fuck-all about it
[06:05:13] sevenseacat: Radar: i presume it would load quite happily from its normal spot, just like factory_girl will
[06:05:19] drim: Radar: and after, how can I load it ?
[06:05:25] willmarshall: But my shitty Python code is FAR more popular than anything else I've done
[06:05:35] Radar: sevenseacat: I don't know. Never used Fabricator.
[06:05:41] Radar: drim: You can require the files.
[06:05:48] Radar: sevenseacat: rly
[06:05:52] sevenseacat: its a drop in replacement for FG
[06:06:24] tubbo: willmarshall: haha well, it filled a big niche!
[06:06:42] tubbo: i need to play more with ableton and max for live...been too focused on maschine
[06:09:56] drim: Radar: it will automatically saved it in database ?
[06:10:02] Radar: drim: what no.
[06:10:24] Radar: That only loads your fabricators... I don't know what the hell your code is doing.
[06:10:29] Radar: You've typed all of 40 words so far.
[06:10:38] Radar: No information at all about what your code is or what you're trying to achieve
[06:10:47] Radar: Just blind stumbling off towards an imaginary goal
[06:11:19] drim: Im just trying to popuplate my db with fake data for my API (to work on the client side)
[06:11:27] Radar: Yes, that much I figured.
[06:11:35] Radar: But I don't know what your code in spec/fabricators is doing.
[06:12:08] drim: pretty simple for now, Fabricator(:user) do name { Faker::Name.name } email { Faker::Internet.email } end
[06:12:20] Radar: Yes. So that is only defining a fabricator to be used. It is not going to create anything.
[06:12:34] Radar: You need to require the fabricators and then call whatever methods you need to call that make it create those objects.
[06:12:48] sevenseacat: http://www.fabricationgem.org/#!fabricating-objects
[06:13:39] willmarshall: tubbo I did all the new scripts for the Launchpad and Launchkey and so on, which I suppose makes me technically a Python dev
[06:13:42] willmarshall: Albeit an incompetent one
[06:14:57] jrobeson: what CI thingies do you folks use?
[06:15:10] jrobeson: other than free travis that is :(
[06:15:39] sevenseacat: we use jenkins internally
[06:16:38] Radar: jrobeson: TeamCity. It's amazing how much it just runs and runs and runs and runs
[06:16:54] Radar: Rocks aspire to be as solid as TeamCity is.
[06:18:10] jrobeson: i shoulda mentioned one more caveat: that doesn't require one to have an internal installation. it's just for me and potentially one more person
[06:18:41] Radar: jrobeson: Any installation at all? TeamCity is very very very simple to setup.
[06:18:55] jrobeson: i don't have any spare computers
[06:19:22] jrobeson: it's just me and my laptop
[06:19:53] sevenseacat: i am over today... is it beer oclock yet
[06:20:33] jrobeson: i was thinking about trying out circle ci
[06:21:34] Radar: sevenseacat: WORK HARDER
[06:21:48] sevenseacat: ACTION grumbles and goes back to solr
[06:22:01] Radar: I started at 8:30 and did some writing and demolished my inbox and now am doing some book reviewing.
[06:22:15] Radar: Albeit I was planning on knocking off at 5pm :P
[06:22:30] sevenseacat: ACTION has been diagnosing and doing bugfixes alllll day
[06:22:31] Radar: sevenseacat: oh it's solr. I'm so sorry :(( I did not know.
[06:22:49] Radar: ACTION calls brewery, sends trucks full of beer to sevenseacat 
[06:31:19] valesk: Where did the default ruby welcome install page go? I can't seem to delete the index
[06:31:44] sevenseacat: its not a static file in rails 4 anymore
[06:31:52] sevenseacat: you can delete it by overwriting your root path
[06:31:56] sevenseacat: point it somewhere else
[06:32:22] valesk: I've added it to: root to: 'statuses#index'
[06:32:27] valesk: and no bueno
[06:32:47] rvanlieshout: valesk: added or changed?
[06:33:39] valesk: Ahhh my sublime color scheme is a little dark and comments are hard to read.
[06:33:52] valesk: Found it, thank ya
[06:34:03] valesk: Here's a noob question though
[06:34:09] valesk: Why is it reading commented out code?
[06:34:27] rvanlieshout: valesk: in routes.rb? it's not..
[06:34:32] sevenseacat: how so? it wouldnt be
[06:34:49] valesk: # You can have the root of your site routed with "root"
[06:34:49] valesk: # root 'welcome#index'
[06:35:15] rvanlieshout: that's not used
[06:35:15] valesk: Unless sublime is just showing that as commented out..
[06:35:16] sevenseacat: that wasnt being read
[06:35:32] valesk: Soon as I deleted that it worked.
[06:35:48] sevenseacat: suspect there was more at play
[06:36:21] valesk: What could be the issue? It's definitely commented out..
[06:37:08] sevenseacat: gist your entire routes.rb file?
[06:40:42] valesk: https://github.com/taylorqj/treebook/blob/master/config/routes.rb
[06:41:10] Radar: tagrudev: hi.
[06:41:11] sevenseacat: so the only route you have is the `resources :statuses`
[06:41:19] sevenseacat: running `rake routes` will verify that
[06:43:07] Radar: tagrudev: hi
[06:43:15] tagrudev: morning peeps
[06:46:02] rzsd: label_tag is automatically changing the case of string i pass to it. For example <%= label_tag 'EmployeeNo' %> is shown as Employeeno. Any way i can preserve the case of the string i pass to label_tag
[06:46:18] Radar: rzsd: label_tag 'EmployeeNo', 'EmployeeNo'
[06:46:23] helpa: Next question, please!
[06:47:02] gamov: I noticed that some of options for selects are a speed bottleneck. Since the options don't change often, I would like to cache them. However, the selected options differs for every record. I looked around the web and didn't see much info about that. I'm wondering if caching the options html then add the selected options from model later with JS is a very bad idea?
[06:47:12] rzsd: Radar: thanks :D
[06:48:12] sevenseacat: options are a speed bottleneck? how the?
[06:48:30] rvanlieshout: gamov: dig deeper.. isn't this caused by gathering all options?
[06:48:40] rvanlieshout: that you then pass to options_for_select
[06:49:58] gamov: rvanlieshout: yes, loading the records with an association to turn them into a options for select takes time
[06:50:24] rvanlieshout: gamov: you're talking about several steps here
[06:50:28] rvanlieshout: what step takes that long
[06:51:16] gamov: rvanlieshout: pulling the records from DB and turning into object
[06:51:45] rvanlieshout: gamov: so pulling is slow AND turning a static list into an object is slow? prove that
[06:53:50] gamov: rvanlieshout: :) good point, it's the pulling (mini-profiler states 900ms against 26ms in the view
[06:54:34] rvanlieshout: those numbers are quite useless
[06:55:11] rvanlieshout: but if you have verified it's collecting the data than remove your options_for_select in your questions
[06:55:13] gamov: the weird part is that in prod, this slowness doesn't appear at all
[06:55:14] rvanlieshout: as it does not seem to matter
[06:55:39] rvanlieshout: that's not weird.. there are many differences between dev en production
[06:56:01] rvanlieshout: but solving this won't happen unless you just look at the single thing that is slow
[06:56:06] rvanlieshout: and forget about everything else
[06:58:59] gamov: rvanlieshout: ok, I profiled them separately, it's clearly pulling that takes long, creating the options is negligible
[06:59:21] sevenseacat: so how are you pulling the records?
[06:59:29] rvanlieshout: gamov: ok.. so what are you gathering and how? show us the code please
[07:00:51] gamov: Something very simple: Supplier.where(inactive: false).where(with_shipping_ability: true)
[07:01:05] sevenseacat: gamov: wem, how many records is that pulling back
[07:01:10] rvanlieshout: gamov: and that produces how many records? got index on inactive and with_shipping_ability?
[07:01:20] gamov: note that Supplier is a STI of Company ; only 57 records
[07:01:43] rvanlieshout: and what query is executed? and what's the result of the explain query?
[07:09:19] gamov: SELECT "companies".* FROM "companies" WHERE "companies"."inactive" = 'f' AND "companies"."type" = 'Supplier' AND "companies"."shipping_ability" = 't' ORDER BY companies.name ;;;; indexes are set ;;; I don't understand the raw EXPLAIN answer from SQLite??? :/
[07:09:35] rvanlieshout: gamov: what database are you using in production?
[07:09:48] gamov: same, SQLite
[07:09:58] rvanlieshout: you've got indexes on inactive, type, shipping_ability and name?
[07:10:48] rvanlieshout: as a combined index or as separate?
[07:11:01] gamov: the explain says: "TABLE companies WITH INDEX NewIndex2"
[07:11:05] gamov: not, separate
[07:11:12] rvanlieshout: cause you might need a combined one for sqlite to use it properly here
[07:11:15] rvanlieshout: or switch to an other db engine
[07:11:23] rvanlieshout: how long does this query take in a sqlite console?
[07:11:38] gamov: rvanlieshout: blazing fast
[07:11:54] sevenseacat: and how long does Rails say it takes?
[07:12:06] rvanlieshout: ^ if executed in a console
[07:12:10] rvanlieshout: rails console
[07:12:19] Technodrome: i love rails but i'm starting a big project, decisions decisions
[07:12:46] rvanlieshout: Technodrome: and that's a problem because?
[07:12:57] sevenseacat: stuff rails. do it in nodejs.
[07:13:04] rvanlieshout: there are several big projects that happen in rails
[07:13:24] Technodrome: yes of course :)
[07:13:30] tagrudev: gonna get down on Friday
[07:13:32] Technodrome: heheh, just me and my uncomfortable self
[07:13:59] tagrudev: where is workmad3 when you need him
[07:14:52] gamov: rvanlieshout: if I understand correctly the explain, it doesn't use the other index, only one.
[07:15:29] rvanlieshout: gamov: sqlite can't use multiple indexes. you need to create a combined one or switch db engine. but more important. this is not your problem as it runs fast in a sqlite console
[07:15:36] rvanlieshout: so how does it run in a rails console
[07:15:41] rvanlieshout: show that it's slow
[07:16:44] gamov: rvanlieshout: in console, average is 150ms, though almost 10x faster than in view???. mmmmmm
[07:17:07] rvanlieshout: then it's slow somewhere else
[07:17:28] rvanlieshout: clean out your view / controller to have it execute less and find out what part is slow
[07:33:06] rzsd: I have two separate databases which have common tables, and i need to update a table in both databases from my model. Any idea how can this can be done ?
[07:33:40] sevenseacat: you have a model attached to two tables?
[07:37:06] gamov: rvanlieshout: if I remove everything from view/controller, same problem. I tried removing tools like mini profiler, foot-notes etc. Same hardware and DB: prod = 54ms vs dev = 1050ms. I guess the next step is to remove gems...
[07:37:18] rvanlieshout: gamov: no stop
[07:37:30] rvanlieshout: raise something on the first line of your controller
[07:37:35] rvanlieshout: how long does it take to get to there?
[07:41:00] gamov: rvanlieshout: any method to time before reaching exception?
[07:45:36] relix: hey guys, I'd like to add crossorigin="anonymous" to the javascript_include_tag
[07:45:57] relix: is that possible? I'm looking at the javascript_include_tag source on apidock and it only lists sources as a imput parameter
[07:46:23] gamov: rvanlieshout Completed 500 Internal Server Error in 374ms
[07:46:39] rvanlieshout: gamov: so now move that line until you found out what line is causing the delay
[07:46:58] relix: it's interesting how this is not a built-in option by the way, when using asset hosts in the asset pipeline, since we'd be loading js from different domains
[07:46:59] gamov: rvanlieshout: excellent idea!
[07:50:16] relix: never mind, it totally supports an option hash, I looked way past the extract_options line
[07:50:59] jrobeson: relix, what version of rails are you using?
[07:51:04] relix: rails 3.2
[07:51:24] jrobeson: ah then you're good with apidock i guess.. just making sure. there are no docs for rails 4 on there still
[07:52:02] relix: jrobeson oh yeah, I'm aware, I'm kind of iffy about apidock because it's sometimes very confusing with all the versions, so I'm always checking if I've got the right version
[08:20:22] gamov: rvanlieshout: ok, 60% of the time is spent in the awesome binding_of_caller...
[08:22:36] gamov: rvanlieshout: anyway, thank you so much for the leads
[08:27:01] apeiros: hurray, the notation rails4 wants (and nags if you don't use it) is not compatible in rails3??? (associations with conditions/ordering)
[08:28:53] benlieb: does rails 4 make it easy to use different smtp server per mailer?
[08:31:20] universa1: benlieb: not having a clue, but i doubt there have been many changes in that part. soudns also kinda unusual ;)
[08:32:43] benlieb: I think it's common these days for an app to send app-specific emails to the devs one way, but thing like Newsletters frequently need more robust (and sometimes costly) methods of delivery. My case right now.
[08:33:04] benlieb: This thread seems to indicate it's possible, and that maybe rails 4 makes it easier... http://stackoverflow.com/questions/1559879/rails-actionmailer-with-multiple-smtp-servers
[08:37:19] universa1: benlieb: http://edgeguides.rubyonrails.org/action_mailer_basics.html#sending-emails-with-dynamic-delivery-options -- maybe
[08:37:37] universa1: http://guides.rubyonrails.org/action_mailer_basics.html#sending-emails-with-dynamic-delivery-options
[08:37:55] universa1: benlieb: so looks kinda simple :-)
[09:19:31] tomoyuki28jp: I want to build dynamic select form by javascript. We can't (or shouldn't) implement it by turbolinks, correct? Which js framework would you recommend?
[09:21:22] tomoyuki28jp: I'm on rails4.
[10:00:45] ravionrails: dynamic select form?
[10:07:53] MonkeyTrousers: I've come across a old project with an 'Actions' folder insidethe Models folder, are those still used in Rails 4?
[10:08:49] rvanlieshout: models != actions
[10:08:56] rvanlieshout: and it never was iirc
[10:09:05] rvanlieshout: what's in these files
[10:19:15] gamov: MonkeyTrousers: Maybe service objects
[10:25:59] MonkeyTrousers: well they are classes inside and are derived from < Action
[10:26:38] workmad3: MonkeyTrousers: well that's something unique to that project
[10:26:48] workmad3: MonkeyTrousers: it's not part of rails
[10:27:15] MonkeyTrousers: ah ok, so not an old convention from rail 2 or something
[10:27:40] MonkeyTrousers: ok ty that clears that one up
[10:28:28] workmad3: MonkeyTrousers: out of curiosity, is there an 'app/models/action.rb' file there?
[10:29:24] MonkeyTrousers: workmad3: yep there is, does that ring any bells?
[10:29:33] workmad3: MonkeyTrousers: you're looking at an STI class :P
[10:29:52] workmad3: MonkeyTrousers: and 'Action' is part of that project's model
[10:30:09] workmad3: (at least, that would be my guess if Action is an ActiveRecord::Base ;) )
[10:30:13] MonkeyTrousers: yeah action is a model class
[10:30:34] workmad3: model's don't have to inherit ActiveRecord::Base
[10:30:45] workmad3: so please don't use those two things interchangable ;)
[10:30:49] workmad3: *interchangably
[10:31:11] workmad3: bleh, and *models, not model's :(
[10:31:14] workmad3: it's friday
[10:32:09] workmad3: MonkeyTrousers: so yeah, 'Action' is something that the project you're looking at creates and manipulates ;)
[10:32:25] workmad3: MonkeyTrousers: not some hidden convention
[11:09:35] corp_: I know it's not really ror specific, but the guys in #dokku couldn't help me so maybe one of you could help me: I'm getting "gem not found" from bundler while deploying with dokku (an app which already has been deployed on this machine with a mysql db which still exists there)
[11:09:39] blackswan: is anybody around who can quickly answer stupid neophyte rails questions about how "rake db:migrate" works under the hood, or point me to some enlightening web page?
[11:09:52] corp_: I was able to deploy a freshly created app (with rails new)
[11:10:25] corp_: what could there make any difference that keeps me from deploying? anything in the gemfile maybe?
[11:10:38] corp_: or rvm stuff? (I installed rvm on that machine)
[11:23:24] corp_: ok, another question
[11:23:37] corp_: what can cause bundle to fail with "gem not found"? where does it look for the gems?
[11:25:04] universa1: corp_: rubygems.org usually
[11:25:14] universa1: if you configured the source correctly.
[11:25:37] universa1: it would probably help if you'd set up a gist with what you're doing, the full error trace, ...
[11:26:18] corp_: yes, I will
[11:26:32] corp_: so this "gem not found" means it can't download it from rubygems?
[11:26:47] universa1: maybe... we can't tell unless we see the full error.
[11:28:25] jrobeson: corp_, it says what sources it's using right when you run it
[11:28:43] jrobeson: the source isn't (or wasn't) there by default
[11:28:44] corp_: jrobeson, yeah, and bundle seems to finish successfully
[11:28:55] corp_: Your bundle is complete! It was installed into ./vendor/bundle
[11:35:43] jrobeson: man .. i needa figure out time cop..
[11:36:01] jrobeson: all that time switching makes my headspin :)
[11:36:08] universa1: jrobeson: do: Timecop.freeze Time.now, then you got more time ;)
[11:51:25] corp_: what really confuses me are those different outputs. the docker log says "start" failed because of bundler, but at the deployment bundler says it succeeded
[11:58:18] BigBlueBacon: Good morning, could anyone offer any tips on running rake assets:precompile without loading the entire environment and connecting to loads of external services such as ElastiCache etc? Thanks
[12:03:04] universa1: corp_: it would be a hell lot easier to help you if you'd start with giving a full acount of necessary information, what and how you're trying to do stuff, when you get what error including the error trace...
[12:03:21] corp_: universa1, yeah, I'm writing it down at the moment, thanks
[12:07:51] corp_: I removed all containers from docker and started a fresh deployment to be able to make a proper documentation and now.. after the deployment I don't even get a container, yay ;)
[12:25:27] DaniG2k: guys when you're setting up emailing, how do you store the user/pass combinations?
[12:25:36] DaniG2k: do you use figaro or something?
[12:26:51] DouweM: DaniG2k: you mean the SMTP username/password? that's what ENV variables are for
[12:28:24] DaniG2k: DouweM: which are just set on the server itslef?
[12:31:04] DaniG2k: DouweM: yea thats what i meant
[12:31:46] mikecmpbll: how're you sending mail?
[12:32:15] DaniG2k: actionmailer
[12:32:26] DaniG2k: although it sounds like its really bad
[12:32:32] DaniG2k: no message queueing
[12:32:44] DaniG2k: and default config goes into applicaiton.rb
[12:32:49] DaniG2k: sounds so bad to be honest
[12:32:55] DouweM: you shouldn't put any credentials in your source
[12:32:59] DouweM: use ENV vars
[12:33:07] DouweM: that are set directly on the server, indeed
[12:33:08] mikecmpbll: i don't have any authentication :`
[12:33:14] mikecmpbll: just uses postfix on the same server
[12:33:33] mikecmpbll: tbh i've never actually thought about it much.
[12:33:39] DouweM: we use sendgrid
[12:35:17] DouweM: DaniG2k: you should send your emails from a worker, that way you get message queuing as well
[12:36:50] DaniG2k: DouweM: yeah thats what I figured. Why the hell isnt this done by default
[12:36:56] DaniG2k: seems like the only sensible option
[12:37:17] DouweM: you want Rails to include an async worker infrastructure by default?
[12:37:49] rvanlieshout: or just install sendmail and have it queue your mail
[12:37:59] rvanlieshout: because sending mail to a worker introduces other problems
[12:38:14] DouweM: they were actually working on adding a common queue api in Rails 4, but it was pushed back
[12:38:16] DouweM: rvanlieshout: like?
[12:38:26] DaniG2k: DouweM: why not?
[12:38:29] mikecmpbll: if you're sending tons of email won't rails still have to render them all and pass them to sendmail?
[12:38:36] rvanlieshout: like that the record on which you're sending mail could have changed before the job was executed
[12:38:50] DouweM: DaniG2k: way outside the scope IMO
[12:39:14] DaniG2k: DouweM: of a web application framework? I don't think it is tbh
[12:39:15] rvanlieshout: and because the default json representation has a bug so that pushing the complete mail to the backgroung might fail (https://github.com/rails/rails/pull/12183)
[12:39:21] jacobat: Any idea where to look if I want to figure out why Rails is logging everything at the same log level? I'm using Syslog::Logger.
[12:39:28] DouweM: rvanlieshout: right, although I've never been in a situation where that mattered
[12:39:50] DouweM: DaniG2k: there's so many options: resque, sidekiq, delayed_job. none of these fits all
[12:40:11] DouweM: DaniG2k: it's not like it's a chore right now to set any of these up
[12:40:16] rvanlieshout: but what's wrong with the most simplest thing as having a default mailer on the local machine?
[12:40:24] DouweM: DaniG2k: but a common interface would've been nice. not sure why it was shelved
[12:40:49] rvanlieshout: DouweM: most likely because there are that many versions each with pro's and con's
[12:41:32] DouweM: rvanlieshout: right, but the Rails.wueue interface was supposed to work with any backend. So the fact that there are so many versions was pretty much the point
[12:41:42] visof: is rake command need DBs setup to can do rake assets:precompile ?
[12:41:55] DouweM: rvanlieshout: I'm gonna read this later today, because I'm curious: https://blog.engineyard.com/2013/rails-4-queue-api
[12:41:58] tbuehlmann: I'd queue the job with sidekiq and just work it off in the worker process.. also, check for the right state of the actual object
[12:42:17] DouweM: tbuehlmann: yup
[12:42:43] rvanlieshout: DouweM: iirc one reason was the fact that it was called queue
[12:42:52] DaniG2k: how bad is it if I don't use any worker processor
[12:42:56] DaniG2k: for emails
[12:42:57] rvanlieshout: you shouldn't have to know the method of execution in that scope
[12:43:11] DaniG2k: can't be bothered to do it now
[12:43:18] rvanlieshout: DaniG2k: it's not.. eespecially if you have a local mailer
[12:43:19] tbuehlmann: DaniG2k, go check it. any email will block if run sync
[12:43:46] DaniG2k: one less thing to worry about
[12:44:11] DouweM: DaniG2k: if you have a local mail server, it's not that big a deal, but keep it in mind for the future
[12:44:39] DouweM: DaniG2k: it's good practice to do any external communication from a worker
[12:44:54] rvanlieshout: ^ any thing that a user doesn't have to wait for
[12:46:43] tbuehlmann: Thread.new { UserMailer.welcome(42).deliver }? :D
[12:48:15] rvanlieshout: won't that thread stop if the request is done?
[12:48:23] DaniG2k: oh another question abaout mailing
[12:48:31] rvanlieshout: or does the request wait for the thread to finish?
[12:48:34] DaniG2k: to prevent spam, I've set up a hidden field called malicious
[12:48:43] DaniG2k: if this gets filled by a bot, the form is not submitted
[12:48:46] DouweM: rvanlieshout: why wouldn't it just outlive the request?
[12:48:48] DaniG2k: does this sound retarded or sensible?
[12:49:05] rvanlieshout: DouweM: dunno.. it depends on how requests are executed
[12:49:12] rvanlieshout: DaniG2k: it won't prevent it if they really want it
[12:49:18] tbuehlmann: rvanlieshout, depends on the server you're using. in generel it could just work
[12:49:25] rvanlieshout: i've read about how one can even get captcha's filled in
[12:49:34] mupkoo: Hey guys, how can I include module dynamicly in ActiveRecord model and make it work with the class caching?
[12:49:34] DouweM: rvanlieshout: sure, but if your ruby isn't killed at the end of every request, it'll probably just work
[12:49:35] DaniG2k: but like 90% of bots tend to fill out everything right?
[12:49:44] elaptics: yeah recently someone managed to break google's recaptcha
[12:49:54] tbuehlmann: DouweM, the process/thread could be killed by your application server setup
[12:49:54] universa1: hmm, most bots won't have js enabled ;)
[12:50:16] rvanlieshout: ^ by creating a porn or warez site and by having those visitors entering the captcha details
[12:50:26] DouweM: tbuehlmann: yeah
[12:50:28] rvanlieshout: ^ = google's recaptcha
[12:51:06] universa1: i added akismet / typepad(iirc) for filtering comments ;)
[12:51:28] DouweM: universa1: how's your experience with akismet?
[12:52:20] rvanlieshout: wait for them to create a pron website to get your spam prevention fixed :)
[12:53:05] universa1: DouweM: hmm, i used typepad antispam which is api compatible. but never had much traffic, so never really tested it.
[12:53:22] universa1: DouweM: but i'm just reading that it is offline since march ;)
[12:55:33] universa1: DouweM: though impermium took over their service, but they don't seem to be actively looking for new users ;)
[12:56:06] DouweM: :) I'm gonna look into akismet
[12:56:53] universa1: DouweM: https://impermium.zendesk.com/entries/23720766-Typepad-AntiSpam-Transition-FAQ -- as the impermium site is more a buzz-word product presentation site
[12:57:45] jrobeson: Radar, are you still using this? or know of any better solution ? https://github.com/radar/dotiw/issues
[12:57:53] jrobeson: i really liked your precision there
[12:58:10] DouweM: universa1: impermium.com is terrible :/
[12:58:31] universa1: DouweM: yeah, my thoughts exactly
[13:17:10] mupkoo: It there a better way to load a module dynamically than self.class.send(:include, Object::const_get(module_name))?
[13:18:11] universa1: mupkoo: what are you trying to do?
[13:18:30] universa1: dynamically loading a module sounds hackish.
[13:19:45] mupkoo: I use this for server control. I am trying to use Polymorphism.
[13:20:31] universa1: mupkoo: sorry, still no idea what you're actually trying to do/which problem you're trying to solve.
[13:20:40] mupkoo: I have couple of server types (modules) and I want to inject them into a ActiveRecord model so they act the same but work different depending on the module
[13:20:58] universa1: but my gut tells me, you're approaching it wrongly
[13:21:21] universa1: mupkoo: why not use simple delegation / method calling?
[13:22:42] universa1: mupkoo: delegate :meth1, to: :behaviour; def behaviour; @behavior ||= some_code_to_get_the_right_instance; end ?
[13:22:44] mupkoo: Any tip on how to implement this with delagete
[13:22:53] universa1: *pseudo-code*
[13:23:40] mupkoo: I will have to test it out
[13:24:23] visof: if i'm using postgresql , rake db:structure:dump will get me psql dump i can load it manually with pg_dump?
[13:24:36] helpa: visof: Why don't you try it and find out for yourself?
[13:24:36] universa1: visof: !try
[13:25:05] universa1: visof: but i personally doubt it
[13:55:27] mupkoo: universa1: Thanks for the tip, now it's working much better. :)
[13:56:04] mupkoo: I am still new to Rails and I haven't used delegate before, but I start to like it :)
[13:57:24] universa1: mupkoo: basically just a short hand for def some_method; some_object.some_method; end :-)
[14:04:09] banisterfiend: Routes.draw do |map| <--- map is optional right? and without it the block performs an instance_eval ?
[14:04:15] banisterfiend: otherwise it's just a block.call ?
[14:04:45] universa1: banisterfiend: best to check the source for draw ;)
[14:05:12] banisterfiend: hehe, i was hoping to avoid that, but good point
[14:06:19] Laptop5: Is block.call a thing? I thought you just passed a block, and you used Proc.call to call your Proc.
[14:06:59] banisterfiend: Laptop5 &block then block.call
[14:07:12] banisterfiend: for an explicit block parameter, implicit block parameters can just be yielded too
[14:07:37] BigBlueBacon: Good morning, could anyone offer any tips on running rake assets:precompile without loading the entire environment and connecting to loads of external services such as ElastiCache etc? Thanks
[14:07:52] universa1: BigBlueBacon: initialize_on_precompile is set to false?
[14:08:35] universa1: you could create a pre-compile environment / set an env-variable while calling the precompile task and do stuff based upon that.
[14:08:42] PPH: How much might it cost to host a normal rails app on heroku?
[14:08:55] universa1: PPH: define normal
[14:09:28] PPH: universa1: an unpopular store qith a couple of visitors a day
[14:09:56] universa1: PPH: if you don't need a bigger database then it's free
[14:09:58] jrobeson: it's free for that
[14:10:02] jrobeson: 10 million rows right?
[14:10:04] universa1: no clue how much the ssl is
[14:10:13] jrobeson: oh yeah.. ssl .. that's likely not free
[14:10:18] universa1: and ssl is something you'd want with a shop!
[14:10:28] jrobeson: you can use stripe without ssl maybe?
[14:10:44] jrobeson: there's always the redirect to paypal payments too
[14:10:48] jrobeson: or any of the others that do hosted pay pages
[14:11:35] PPH: yeah we are planning on using paypal to handle the money
[14:13:01] PPH: it's for a friend who want to sells the cloth she knit on the web... It shouldn't be such a big/popular website... lol
[14:16:59] jrobeson: PPH, and why not etsy or some other marketplace?
[14:17:05] jrobeson: it'll be much easier on everybody involved
[14:20:28] PPH: jrobeson: I don't know etsy but she was using storenvy and didn't like it
[14:20:44] jrobeson: i'd suggest using another one if possible
[14:20:48] jrobeson: shopify maybe?
[14:21:12] jrobeson: depends on whether you want to be part of a marketplace of other stores, or you want it to be standalone
[14:21:33] jrobeson: i feel like people who do what she does would get easier exposure by being part of a marketplace, then if it gets big enough move to your own store
[14:21:50] omarqureshi: etsy would be the best place to start.
[14:21:57] PPH: I agree
[14:22:11] PPH: I'll tell her about etsy
[14:38:48] jarr0dsz: when upgrading form unicorn to puma for production i noticed im still deploying my app as root so i found some blog posts on creating a user deploy
[14:39:12] jarr0dsz: would deploy:x:496:493::/home/deploy:/bin/bash be okay? not sure about if it needs the bin/bash shell guess it needs that to run the capistrano commands right?
[14:41:03] Hirokiraj: you can use set :user, username in deploy config for specyfic stage
[14:41:31] hiall: Hi, after selecting a hash wanted into a multihash object how do i update that hash and reinsert it? i.e. http://paste2.org/3LCAsf97
[14:44:12] batasrki: hiall: by assigning the new hash to the hash_id_wanted key?
[14:44:58] nettoweb: guys, is it possible use "@product.find_related_tags(:conditions => "active = 1", :limit => 1)" using the acts-as-taggable-on?
[14:45:16] nettoweb: I'm looking at the repo, but found nothing about conditions
[14:45:19] hiall: batasrki: how do i get the key as im purely selecting the object based on value?
[14:46:12] Hirokiraj: hiall: how bout finding position in array after select and then inserting in that specyfic position?
[14:49:03] hiall: o0 yea Hirokiraj thanks :)
[14:49:19] Hirokiraj: hiall: after finding hash: Hash[array_of_hashes.map.with_index.to_a][hash_found]
[14:49:58] Hirokiraj: hiall: gives you a position in array so after change you can insert there
[14:50:11] hiall: awesome thanks a lot Hirokiraj
[14:52:18] workmad3: hiall: err... you don't need to reinsert...
[14:54:19] workmad3: hiall: unless something else is going on that you haven't shown, the code you have there will update the hash inside the hashes array... no need to mess around with re-inserting
[14:54:49] hiall: Yea didnt even know it did that workmad3
[14:54:54] hiall: crazy ruby ;)
[14:54:57] workmad3: hiall: not 'crazy'
[14:54:58] hiall: thanks for your help guys
[14:55:02] workmad3: hiall: you get back a reference to the same object
[14:55:13] workmad3: hiall: so when you then re-assign the hash key, it updates the same object
[14:55:36] Hirokiraj: hiall: but need to reinsert if you got some messed up two-array-different-positions stuff
[14:55:50] hiall: I was just wrongly under the impression that setting that variable to a specific hash made a new object and didn't relate to the old one
[14:56:08] Hirokiraj: hiall: but working on one hash, when you get object as you do and modify it, it modify object itself, it does not create copy of it
[14:56:14] workmad3: Hirokiraj: the only time you'd need to reinsert is if you cloned or duped the hash, or there were different hashes in the two arrays :)
[14:56:17] hiall: need to read more about core ruby...
[14:56:34] Hirokiraj: workmad3: exacly ;)
[14:56:59] workmad3: but still :) always good to see a non-problem get answered ;)
[14:58:38] hendricius: rails question : ). i want to chain multiple OR clauses
[14:59:03] hendricius: [:foo, :bar] are the values I want to perform an OR check with.
[14:59:26] workmad3: hiall: btw, if you did need to track the position, it would be better to do 'hashes.select.with_index{|hsh, idx| ...}' and stash the found 'idx' of the appropriate item :)
[14:59:41] hendricius: Model.where("foo is NULL or bar is NULL") -> this works. but i just want to pass an array to the function.
[14:59:43] workmad3: hiall: rather than re-finding the index again
[15:00:25] relix: I'm deleting several records from an association, but indirectly, so not using the association
[15:00:51] relix: as expected, if the user, which has many comments, was loaded before removing a comment, this user's comments will still have the "ghost" comment in there
[15:00:53] relix: I can do user.reload
[15:01:17] relix: but if I have the comment, and the user, is there a way to remove that comment from the user's association directly?
[15:01:30] relix: so that the association is updated automatically, much like doing user.comments.create
[15:02:07] relix: destroy(object)
[15:02:12] tagrudev: workmad3, <3
[15:02:19] tagrudev: gonna get down on Friday ?
[15:08:00] helpa: tagrudev: Why not try Chinese Food? http://www.youtube.com/watch?v=wWLhrHVySgA
[15:08:00] workmad3: tagrudev: !hungry
[15:12:45] tagrudev: workmad3, more like thirsty
[15:14:17] odigity2: The edgeguide for testing mentions a bunch of db:test:* rake tasks, but I'm using Rails 4.0, and I don't see those. Anyone know why that might be?
[15:15:33] blackmesa: Hi all. I was trying to put some ajax behavior in my form and was following the 4.1 A Simple Example on http://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html . This does use a create.js.erb. Does this actually use json?
[15:17:54] odigity2: ah ha! I found the answer. and it's stupid. http://stackoverflow.com/questions/4911717/why-are-some-rake-tasks-missing
[15:18:08] relix: so a User has many comments
[15:18:16] relix: is there a way to get the comments from all users?
[15:18:28] Criten: User.coments
[15:18:38] relix: Criten does that work?
[15:18:40] rangafangs: I'm a rails noob. I'm building an app using Devise. Whats the best way to go about modeling multiple user types?
[15:18:40] Criten: ...as long as it's setup correctly :)
[15:18:54] relix: cool! I'll try it out thanks
[15:18:54] Criten: I don't know your structure... but it should
[15:19:12] odigity2: rangafangs, you're more likely to get that answered in a devise-specific room than a general rails one
[15:19:46] Criten: rangafangs, that's not really devise-specific
[15:19:53] relix: Criten ah I was wrong, it's a belong_to not a has_many
[15:20:03] Criten: Should still work :)
[15:20:13] Criten: err... wait
[15:20:14] odigity2: rangafangs, also, there seems to be a lot of answers here, some may be relevant to you: https://github.com/plataformatec/devise/wiki/_pages
[15:20:19] relix: Criten in rails 3.2?
[15:20:38] relix: in either case it's not working :)
[15:20:42] Criten: shouldn't a user has_many :coments
[15:20:47] Criten: comments belong_to :user
[15:20:57] Criten: with a user_id on the comment
[15:21:05] relix: Criten yeah but actually it's a Project belongs_to ProjectManager
[15:21:07] rangafangs: Ok cool thanks odigity2
[15:21:13] relix: and i'd like to get all projectmanagers
[15:21:26] relix: Project.all.map(:&project_manager)
[15:21:30] relix: ^ anything better?
[15:22:01] Criten: is there only ever one project manager on a project?
[15:22:10] relix: Criten yes
[15:22:21] Criten: and users have many projects?
[15:22:31] Criten: er.. projectManagers have many projects
[15:22:47] Criten: Yeah.. should be pretty much what I said before
[15:22:50] relix: projectmanager *is* a user, it's linked to belongs_to with a foreign_key
[15:23:35] Criten: so users can be projectsmangers, or other types?
[15:23:36] voidbottle: http://pastie.org/8465650 could you same please? is manager_not_admin method do the same thing as avoid_admin_subordination and i can remove it? I don't understand why when i take a "customer" user and set for him admin's manager_id then avoid_admin_subordination works and refuse this action. Why? !
[15:24:08] voidbottle: * could you say me please.
[15:24:49] relix: Criten yes
[15:25:20] Criten: and project managers need different details so you link them to a different table?
[15:28:27] relix: no, Project has a project_manager_id column
[15:28:46] Criten: relix, does that just link to a user?
[15:30:17] Criten: I think i know what you're doing... is there multiple blong_to :users on the project?
[15:30:25] corp_: can someone help me with this gist? https://gist.github.com/alexander-mayr/333d047cec0d3f1edc2c
[15:30:31] Criten: so it can have a projectmanager, finanaceguy, etc
[15:55:50] BigBlueBacon: How come this comes out as a string rather than JSON?
[15:55:51] BigBlueBacon: render json: {success: true, address: @address.to_json(only: [:id, :lat, :lng]) }
[15:56:14] terrellt: I need some help. I have this: https://gist.github.com/terrellt/bc0997d31c149117f5f5#file-reserver-rb-L6, but that line is becoming a bitch to test. The conditional include adds validations and I can't test both sides of the condition because it caches the class.
[15:57:20] DouweM: BigBlueBacon: @address.to_json returns a string. you're looking for #as_json, which returns a Hash, which is then turned into a JSON string along with `success: true`
[15:58:25] BigBlueBacon: DouweM: Oh, right, thanks!
[16:02:18] elaptics: terrellt: what, specifically, are you trying to test?
[16:02:32] elaptics: terrellt: the inclusion of it or the role it's playing, or???.?
[16:02:42] terrellt: The role it's playing.
[16:03:28] terrellt: Specifically that those validations and callbacks occur if that config option is set.
[16:11:56] AntelopeSalad: should i be replacing every single after_save/after_destroy callback with after_commit?
[16:13:28] elaptics: terrellt: sorry, was distracted, what class is being cached?
[16:13:44] elaptics: terrellt: in the one test?
[16:13:53] terrellt: Just by the test environment in general.
[16:14:09] elaptics: terrellt: what are you using rspec?
[16:14:27] terrellt: So in a previous test it sets keycards to be enabled, which includes those validations/methods. In future tests, when that option's disabled, it still has those because the class is cached.
[16:15:20] elaptics: terrellt: the keycard enabled option - is this an all or nothing setting for the application?
[16:15:47] elaptics: terrellt: I mean, could you check for that in an initializer or something and then mix it in there when the app starts?
[16:16:10] terrellt: Yeah, but it would be the same problem, no?
[16:17:33] elaptics: how is testing done if the app is being coded in the DCI style - I'm not too familiar with it but the gist seems to be to dynamically add the roles to the core classes as needed?
[16:18:00] terrellt: This is the only time this happens. There's a feature requirement that says other people who use the system need to be able to turn the keycard feature off.
[16:18:24] terrellt: This is the most maintainable way I could think of to make that the case.
[16:18:43] terrellt: At one point I was including things to the singleton_class, but it still broke because of how Rails validations work.
[16:18:49] odigity2: wtf? the docs for rake say that 'rake -A' is "Show all tasks, even uncommented ones". yet when I run it, it runs my test suite.
[16:19:03] terrellt: Isn't it rake -T?
[16:19:11] odigity2: kinda like flipping the bathroom light switch and having the toilet flush :)
[16:19:22] odigity2: rake -T shows the "popular" tasks. -A is supposed to show them all
[16:20:00] terrellt: Huh, same thing happens to me.
[16:20:05] odigity2: for example, the db:test:* tasks don't show up in rake -T, but they do in rake -P, because they do exist
[16:20:33] odigity2: I know. I'm falling down a rabbit hole right now. It all started with reading the edgeguide on testing and seeing the db:test:* tasks mentioned, but not seeing them in rake -T. so I started digging...
[16:21:10] odigity2: rake -P shows all tasks with dependencies (it's a shockingly long list), but no descriptions. I was hoping -A would be the end of the journey, but then it ran my test suite instead, and I was floored.
[16:22:00] terrellt: It's because --all is a modifier to -T
[16:22:14] odigity2: how'd you figure that?
[16:22:28] terrellt: https://github.com/jimweirich/rake/blob/master/doc/command_line_usage.rdoc
[16:22:39] odigity2: wow, that worked
[16:22:58] terrellt: So rake -T -A should be what you're lookin' for.
[16:23:01] odigity2: that note is not shown when you do 'rake --help' on the command line!
[16:23:11] terrellt: Indeed. You should send a pull request.
[16:23:11] odigity2: would have been useful info
[16:23:15] odigity2: you're right
[16:23:30] terrellt: elaptics: Any ideas? There has to be a way to do this.
[16:24:16] elaptics: terrellt: let me have a think - I've just got to sort out an error that's just been reported to me on a production site...
[16:31:45] terrellt: elaptics: https://gist.github.com/terrellt/3306f488203c06a713cc Less tricksy is better.
[16:34:10] elaptics: terrellt: aha :)
[16:36:38] EminenceHC: My simple javascript function does not seem to be working? Can anyone spot why? https://gist.github.com/EminenceHC/7373752 hide.js is being loaded to the page.
[16:37:46] terrellt: EminenceHC: Is the DOM loaded when that runs?
[16:37:59] terrellt: AKA, is it in a document.ready block or at the end of the page?
[16:38:26] EminenceHC: terrellt: It is not in a document.ready block I was told that turbo links does not support that.
[16:38:40] terrellt: Well then in a whatever-it-is-turbolinks-renames-that-to block.
[16:39:41] EminenceHC: terrellt: I don't follow
[16:39:52] EminenceHC: terrellt: Pardon me
[16:39:54] terrellt: Turbolinks didn't just make not waiting for the DOM not be a thing.
[16:40:11] terrellt: Let's see how many negatives I can put in one sentence, what a train wreck.
[16:40:14] EminenceHC: terrellt: So I should still add document ready?
[16:40:30] EminenceHC: terrellt: That was only one negative, try harder.
[16:40:43] terrellt: Not waiting and not be a thing is two.
[16:40:52] terrellt: https://github.com/rails/turbolinks/#events
[16:41:07] tubbo: terrellt: turrible.
[16:41:26] terrellt: So put it in something like $(document).on('page:load', function(){});
[16:42:46] EminenceHC: It still does not seem to be working. I have updated the gist.
[16:43:43] tubbo: EminenceHC: throw a debugger in there, does the code get run?
[16:44:20] tubbo: also i've never seen 'input:checkbox' before. could you try 'input[type=checkbox]'?
[16:44:32] tubbo: the ':not(:checked)' should be ok...i guess...
[16:45:09] EminenceHC: tubbo: Hmm still didn't seem to make a difference. What should I debug?
[16:45:24] EminenceHC: tubbo: Maybe this is just old JS code that can't be recognized
[16:45:34] tubbo: EminenceHC: just use debugger to see if it gets into the code. if it doesn't, maybe the JS isn't being executed because your selector doesn't work.
[16:45:43] tubbo: EminenceHC: try opening up a console and doing $('input:checkbox'). do you get [] back?
[16:45:47] EminenceHC: tubbo: I stole it from someones fiddle because i suck at js
[16:45:57] tubbo: EminenceHC: that's cool, most people do
[16:46:21] tubbo: i urge you to continue looking further at JS as it's a pretty cool lang once you get the hang of it
[16:46:33] tubbo: i draw many similarities to ruby
[16:46:42] terrellt: jQuery docs say input:checkbox works.
[16:47:11] terrellt: I'm curious if the page:load event is firing, really.
[16:47:15] EminenceHC: tubbo: when I type $('input:checkbox') into console it returns.. <input type="checkbox" name="address"><input type="checkbox" name="phone">
[16:47:36] tubbo: EminenceHC: beautiful. we know that code works. now let's figure out why it's not getting called. have you tried this in a $(document).ready() yet?
[16:47:37] EminenceHC: I do see hide.js in the resources tab
[16:47:37] terrellt: Either have a console.log statement in there without a selector or set a variable you can check
[16:48:03] EminenceHC: I have wrapped it with $(document).on('page:load', function(){ });
[16:48:08] melee: if it returns the objects in console but not in the application, there's a good chance you're not wrapping in a ready
[16:48:14] terrellt: (You're sure you're using turbolinks right?"
[16:48:35] tubbo: EminenceHC: try changing 'page:load' to 'ready'
[16:48:43] EminenceHC: In my application.js I have: //= require jquery.turbolinks and //= require turbolinks
[16:49:02] EminenceHC: tubbo: That did it!
[16:49:06] mrfoto: there are two events you need to bind too - ready and page:load
[16:49:06] tubbo: EminenceHC: bam
[16:49:14] tubbo: ahhh ^^^ mrfoto figured it ou t:)
[16:49:28] tubbo: EminenceHC: to bind both events, do $(document).on('ready page:load'..
[16:49:28] EminenceHC: Should I put page:load in there also?
[16:49:33] tubbo: sure why note? :)
[16:49:36] terrellt: You have to bind to both?
[16:49:41] terrellt: That seems like bad design.
[16:49:48] mrfoto: the way I do it is that i have a function in coffeescript and then i have a script tag in the html that fires up that function
[16:49:48] tubbo: terrellt: uhh, it's turbolinks dude :\
[16:49:48] melee: don't bind both
[16:49:56] tubbo: turbolinks is by design, a bad design.
[16:50:04] melee: kinda agree :P
[16:50:07] melee: but its TURBO
[16:50:12] EminenceHC: Binding both doesn't mess it up, should I keep it in there for good measure or just use one?
[16:50:14] tubbo: ACTION is gonna make tubbolinks
[16:50:31] tubbo: it will just fire events at random
[16:50:33] melee: such fast
[16:50:41] tubbo: because fuck your javascript
[16:50:54] EminenceHC: Thanks, you guys come through, once again.
[16:51:14] terrellt: Tubbolinks: $("a").click(function(e) {alert("Screw you."); e.preventDefault();});
[16:51:19] tubbo: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[16:51:31] mrfoto: if you've ever done any advanced AJAX turbolinks is not that different
[16:51:50] melee: i have - would rather leave it to ember or something
[16:51:51] mrfoto: it simplifies a lot of things but it takes for granted you know basics of JS
[16:51:52] EminenceHC: Tubbos links will play sounds on each action also
[16:52:06] tubbo: terrellt: on a serious tip, i think the reason they did that was so turbolinks will also kinda-sorta work with existing scripts that bind the doc ready. it also might be a less-hacky approach than having 'page:load' also fire 'ready'.
[16:52:23] tubbo: as i said, turbolinks is kind-of a hack to get around what browsers ought to be doing natively...
[16:54:20] EminenceHC: Is there any performance reasons to have the javascript just get loaded on the pages that need it? Or is it such a small amount of code that it doesn't matter?
[16:56:22] mrfoto: EminenceHC: could you elaborate? i dont know what u mean
[16:57:02] EminenceHC: mrfoto: It seems like if I put a .js file in the assets folder it will get loaded on every page, right?
[16:57:27] melee: there's scoped loading in rails
[16:57:54] EminenceHC: Is it worth it for small amounts of JS or is that just for large scripts?
[16:58:02] melee: it's really good practice
[16:58:14] mrfoto: EminenceHC: it will compile into one manifest js file on production anyway
[16:58:29] terrellt: melee: What's good practice?
[16:58:59] melee: loading only what you need to per controller
[16:59:10] terrellt: In the case of javascript?
[16:59:23] terrellt: I don't think that's true.
[16:59:44] melee: i mean, there's definitely some application level stuff
[16:59:51] mrfoto: mikecmpbll: http://www.youtube.com/watch?v=kfVsfOSbJY0
[17:00:02] mikecmpbll: thanks mrfoto!
[17:00:09] mrfoto: mikecmpbll: yw :P
[17:00:10] mikecmpbll: that's gunna get me in the friday mood ..
[17:00:25] terrellt: The asset pipeline practically makes "give me all ur JS" a requirement. I'd rather pay that cost up front and have it cached.
[17:04:47] mrfoto: terrellt: yeah, i preffer that too. and if i have a complex part of the site, i separate them, so i have 1 js just for that
[17:05:09] mrfoto: so that i dont have a heavy js for a feature user might not see/use
[17:05:18] melee: terrellt: it's been a while, but i think when i did it for a touch kiosk, we loaded the libraries into asset pipeline (and again the application level stuff) and did the more controller-specific stuff in separate files
[17:05:23] melee: similar to what mrfoto is saying
[17:05:26] mrfoto: simple case being separating admin and frontend
[17:05:56] terrellt: melee: Hey, I wrote three of those recently. I loaded everything into the pipeline and keyed off HTML elements.
[17:06:00] salt_: can anyone see this?
[17:06:22] mrfoto: salt_: no
[17:06:32] melee: that may be the better way to do it :P i just thought it would create unnecessary overhead by loading what wasn't necessary for that controller/view
[17:06:34] mrfoto: salt_: :P
[17:06:50] salt_: haha, awesome
[17:07:43] mrfoto: melee: it depends. like if you have 5 simple jQuery on click handlers it doesnt really matter if its compiled into one big manifst
[17:07:43] rhizome: deal with "unnecessary overhead" when it becomes a problem
[17:08:08] mrfoto: but if you have a complex part of the site its probably better to separate it
[17:08:14] terrellt: With javascript, that's probably never. Hence client-side applications.
[17:08:48] melee: i just started messing with ember and need to get that whole thing figured out with regards to overhead and magic, haha
[17:09:12] mrfoto: melee: yeah i have to look into that soon too
[17:09:22] mrfoto: some ember dems just look awesome
[17:09:39] jlebrech: still here guys?
[17:09:41] melee: still getting my bearings with it which is frustrating
[17:10:02] jlebrech: sorry this is multitimzone, wrong channel
[17:10:33] salt_: so making sample data for carrierwave is making me feel along and scared
[17:10:41] salt_: heres what i got: https://gist.github.com/saltandbeer/bd33c37d8784ba548697
[17:11:02] salt_: feel free to laugh
[17:12:23] mrfoto: salt_: well weekend is nil
[17:12:53] mrfoto: salt_: sorry no
[17:12:58] mrfoto: salt_: nevermind :D
[17:13:24] salt_: ah, i thought you had made a revelation
[17:13:40] mrfoto: salt_: weekend.images is empty relation
[17:13:47] mrfoto: probably you dont have any images?
[17:14:09] terrellt: salt_: The weekend just doesn't have any images.
[17:14:14] salt_: um, thats what i was hoping to accomplish with this
[17:14:18] terrellt: salt_: That being said, why are you doing this terrible thing?
[17:14:44] salt_: terrellt: because i dont know how else to do it
[17:15:06] salt_: terrellt: what do you mean and how would i do less terrible
[17:15:18] terrellt: salt_: What is the sample data for? Clicking around so you know your interface works?
[17:15:21] mrfoto: salt_: what do you want to accomplish?
[17:15:29] odigity2: terrellt, https://github.com/jimweirich/rake/pull/233
[17:15:59] terrellt: salt_: Check out Capybara and write some integration tests man. Factory Girl can build the users, you can have the script upload files.
[17:16:13] salt_: i want to be able to have a user show their 'weekends' which are groups of photos that can be voted on as a whole
[17:16:19] terrellt: odigty2: +1! Well done.
[17:16:25] melee: Fetching: cocaine-0.5.3.gem (100%) something about this just doesn't feel right
[17:16:30] melee: (slash nick robford)
[17:17:31] salt_: terrellt: oh man, testing scares me even more than the dev environment
[17:17:44] terrellt: salt_: Time to level up.
[17:18:06] melee: why? it's fun
[17:19:10] salt_: ok that said, do you know any good resources about writing tests?(i do have tests, mostly ones i just translated from the hartl tutorial)
[17:21:49] melee: i try to start with the guides where possible
[17:22:15] melee: not sure if the latest ones include all of the fun gems like factorygirl/cucumber/whatever
[17:23:16] banisterfiend: why do <form> elements in rails need to have a <div> containing its contents?
[17:24:44] msimkins: salt_: Pragprog do a good book - The RSpec Book :)
[17:25:28] salt_: msimkins: thanks I'll check it out
[17:25:57] Jamo: banisterfiend: they dont
[17:26:55] banisterfiend: Jamo from the rails guides page: "Now, you'll notice that the HTML contains something extra: a div element with two hidden input elements inside. This div is important, because the form cannot be successfully submitted without it."
[17:27:09] banisterfiend: or is it referring to the hidden input elements being necessary not the div itself?
[17:27:30] salt_: i suppose it would have helped if i called the make_photos method, huh? hahaha
[17:27:30] Jamo: afaik, the hidden elements
[17:27:35] banisterfiend: Jamo http://guides.rubyonrails.org/form_helpers.html
[17:27:41] DouweM: banisterfiend: the fields are important, not the div itself
[17:27:53] banisterfiend: DouweM so out of curiosity, why is there a containing div?
[17:28:13] Jamo: div is probably just for styling it
[17:28:17] DouweM: banisterfiend: to make sure there is no extra margin/padding due to the extra element
[17:35:45] melee: do you guys usually skip rdoc/ri docs when installing gems
[17:35:55] melee: they seem to take forever on my machine (and it's pretty fast)
[17:35:59] alex88: hi guys, I'm new to rails, I've to create a class to consume an external api
[17:36:06] alex88: where I should put that? lib/ ?
[17:36:32] terrellt: alex88: Probably. Make sure someone hasn't written it for you.
[17:37:24] alex88: terrellt: yeah it's our internal service, maybe I'll search just for a REST consumer or something like that
[17:37:58] rhizome: melee: http://stackoverflow.com/questions/1381725/how-to-make-no-ri-no-rdoc-the-default-for-gem-install
[17:38:33] rhizome: frankly i don't ever use cli docs, though i kind of wish i knew how
[17:38:34] melee: touch ~/.gemrc
[17:38:40] melee: whooooooooops
[17:40:24] rhizome: gem server is pretty terrible
[17:40:37] terrellt: Gaah, Travis is driving me nuts.
[17:40:38] rhizome: a definite contribution opportunity
[17:40:54] rhizome: i wonder how many jenkins boxes are named "leroy"
[17:41:14] terrellt: All of them.
[17:47:34] voidbottle: guys where i can read about prevent removing users if he has_many subusers?
[17:47:57] voidbottle: i want to admin remove all subusers before and then he be able remove parent user
[17:48:25] msimkins: voidbottle: explicitly ?? - Otherwise use dependent :destroy
[17:49:10] Jamo: using before_destroy callback on active record
[17:49:14] Jamo: http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html
[17:49:14] voidbottle: msimkins, hello, thank you for reply. okay i should read about dependent
[17:49:32] msimkins: voidbottle: if you wnat to do it explictly, you need to do a check in the before_destry action
[17:49:51] msimkins: voidbottle: (as Jamo just typed faster than me :)
[17:50:09] voidbottle: i want to _prevent_ removing User if he have _any_ subusers.
[17:50:28] msimkins: voidbottle: Then do it in the before_destroy
[17:50:28] voidbottle: but ok, i understand
[17:50:31] jarr0dsz: anyone uses susnspot solr: i try to boost a boolean value to not much result
[17:50:36] Jamo: (if it return something ==false, it will not remove it
[17:50:53] jarr0dsz: not even sure if boolean can be boosted the docs are not that complete
[17:51:21] msimkins: the callback will need to check for something like @user.subusers.size >0, or @users.subusers.nil? or somesuch
[17:51:48] Jamo: msimkins: yea, but
[17:52:07] Jamo: since its in model, you need to use self
[17:52:17] Jamo: self.sub_users.empty?
[17:52:48] Jamo: ofcourse checking its size works too
[17:52:50] Technodrome: how often in your guys does your controller use the full CRUD?
[17:52:51] msimkins: Jamo, yes you are correct - Sorry, im running on empty right now.... Need to go home and sleep :)
[17:52:54] Technodrome: 50 percent of the time?
[17:53:04] Technodrome: I know its a weird question but just wondering :)
[17:53:29] msimkins: Technodrome: 100% of the time (well, in the tests anyway :)
[17:53:35] gerep: Hi all. I don't have a doubt about Rails but I'd like suggestions to do what I need. There is a huge update that I need to document, show the areas in the code that will be updated, database new/removed columns. My doubt is, is there a document where I can do that? :)
[17:53:49] Technodrome: msimkins: obviously every resource isn't going to need the full CRUD :)
[17:54:04] Technodrome: some might just need a show and "index" view
[17:54:40] msimkins: Technodrome: well, that is true, but I meant that if you code it, it should be tested :)
[17:55:07] Technodrome: msimkins: like i hardly ever need a delete, my app doesn't delete much
[17:55:13] Technodrome: and only some things need updating
[17:55:16] msimkins: Technodrome: I have Sessions Controllers that only have create/destroy
[17:55:33] Technodrome: what are they for? auth system or something?
[17:55:49] mrfoto: gerep: CHANGELOG.md?
[17:56:54] gerep: mrfoto that will be used after the update, I'm looking for a way to document the future updates so I can show to the other developers so they'll discuss it and we'll decide what's best
[17:57:38] mrfoto: gerep: depends on your workflow - we do that in our project management tool which in rails fashion is Basecamp of course :P
[17:57:49] msimkins: Technodrome: That is also true, which is why (to an extent) it is an unanswerable question - Most of the stuff I write is full CRUD, but it may be that most of the actions are restricted to a manager/admin type role - so is that 12ish % (the public index action), or 100% (you can do it all if you have the rights to do it )
[17:58:09] gerep: mrfoto yes we have Basecamp here, so I'll use it :)
[17:58:13] gerep: mrfoto thanks :)
[17:58:26] rhizome: gerep: git/svn diff
[17:59:24] Technodrome: msimkins: so all your actions get run through just a few methods on the public end?
[17:59:44] mrfoto: gerep: do what the team feels comfortable with. if its 100% technical we open up an issue on GitHub and debate there - if its a more general thing we use basecamp. If its a 2 ppl thing we use email. again - it depends :P
[18:00:21] msimkins: Technodrome: in most cases at least 1 or 2 actions will be restricted in some way
[18:00:36] gerep: mrfoto yes, I'll go with you suggestion, seems better than writing documents :)
[18:01:09] mrfoto: gerep: for a debate stuff tools like google docs can be helpful too, so everyone can edit the same document. there are gazillion of ways :P
[18:05:00] voidbottle: msimkins, seems i can use dependent: :restrict_with_error
[18:06:02] msimkins: voidbottle: You should be able to
[18:06:38] msimkins: I seem to rememer it not being well documented though
[18:06:52] msimkins: so in your case a more explicit callbask may be cleaner to implement
[18:07:21] msimkins: or at least clearer to understands
[18:08:21] Technodrome: msimkins: how long you been using rails for?
[18:09:07] msimkins: Technodrome: About 15/18 months
[18:10:56] msimkins: Ok All, I will wish you a good weekend, I probably wont be back on until Monday :)
[18:17:11] voidbottle: msimkins, hmm it's not works... has_many :subordinates, class_name: "User", foreign_key: "manager_id", dependent: :restrict_with_error
[18:17:38] voidbottle: i try to remove user that have subordinates from Rails console and it's removes without any errors
[18:23:43] voidbottle: User.destroy(5) -- how to get more info about reasons why i can't destroy object?
[18:24:28] tbuehlmann: voidbottle, `user = User.find(5); user.destroy; puts user.errors`
[18:24:43] voidbottle: tbuehlmann, thanks!
[18:33:03] FallLine: is there a way to query authlogic's sessions by user -- say if I want to delete a particular users session?
[18:34:27] terrellt: So this is a question which may get shot down by a bot message, but has anyone had a good experience using rails-settings? Considering implementing and want to make sure it's not too much trouble.
[18:36:53] tbuehlmann: don't even know what that is
[18:44:28] odigity2: anyone maybe know why "rake db:create" and "rake db:drop" are creating and dropping both my development and test databases, even though the docs say it only affects the database for the current environment? (development)
[18:45:33] tbuehlmann: odigity2, I experienced the same behaviour, but only with postgresql, not mysql
[18:45:46] odigity2: yes, I'm using postgresql. isn't that weird?
[18:46:01] odigity2: I mean, do you understand why?
[18:46:07] maletor: A design pattern I often have is to create nested attributes for an object but to not always create new objects, but associate existing objects. I know this is possible using "id", but what if I want to do it on another child attribute like "external_id"? I will need a custom solution that involves making a loop and only building the child objects if the "external_id" is not present.
[18:46:22] odigity2: this is my first time doing rails with postgresql, lots of new quirks to experience
[18:46:42] tbuehlmann: nope, no idea why
[18:46:46] tubbo: odigity2: does that for me with mysql too
[18:46:51] amortimer_mbp: If I'm using Nginx and Unicorn to serve my rails app what exactly is happening? Aren't they both HTTP servers? Does anyone have an article that illuminates the problem they solve?
[18:47:07] tubbo: odigity2: never mattered to me since my test DB's data is never guaranteed.
[18:47:11] tubbo: (unless i'm in a test)
[18:47:11] FooBarWidget: amortimer_mbp: unicorn has to be put behind nginx, by design
[18:47:16] tubbo: the test DB has never mattered
[18:47:16] FooBarWidget: the unicorn website explains why
[18:47:26] amortimer_mbp: Thank you much.
[18:47:27] FooBarWidget: http://unicorn.bogomips.org/PHILOSOPHY.html
[18:47:37] tubbo: amortimer_mbp: unicorn "fills in the gaps" that nginx and unix leave
[18:47:40] diegoviola: I have a Company model that has validates_uniqueness_of :subdomain, that works fine but i want to add some js/jquery code that will also validate via a blur() (when the input loses focus), basically some ajax thingy to also validate via js, do i need additional code in the server-side to do this? what do you guys suggest?
[18:47:46] FooBarWidget: this also means that unicorn is good for some workloads, but bad at other workloads
[18:47:51] FooBarWidget: also by design
[18:48:04] odigity2: tubbo, I agree it probably doesn't matter. But when things don't work like they're supposed to, I like to figure out way to make sure I'm not misunderstanding or possibly screwing something up.
[18:48:23] amortimer_mbp: You folks are great. Thank you.
[18:48:40] maletor: Anny way to make this prettier using accepts_nested_attributes? https://gist.github.com/maletor/dcf1a0882480bfa31493
[18:48:54] tubbo: odigity2: seems like the right idea. :)
[18:49:00] FooBarWidget: amortimer_mbp: but you might want to use phusion passenger + nginx instead of unicorn + nginx. the former combo is a lot easier to setup and makes deployment significantly less complex
[18:49:39] diegoviola: any ideas please
[18:50:38] terrellt: amortimer_mbp: Fair warning, FooBarWidget is an employee.
[18:50:59] FooBarWidget: yes, phusion passenger author here ;)
[18:51:03] FooBarWidget: it's a shameless plug
[18:51:28] tubbo: maletor: https://gist.github.com/tubbo/a5de6305cb7165f382ee
[18:51:44] tubbo: maletor: you can just set the attribute to an array of things and the proper query will be created
[18:51:45] voidbottle: guys i am using Ruby mine and i need to debug recursive function is there any option Step by step debugging + view values on each step?
[18:52:09] amortimer_mbp: I walked into a stack using nginx and unicorn. And I am managing deployment of those apps, so I'm familiar with them. I just had one of those gaps that needed filled.
[18:52:45] terrellt: amortimer_mbp: To simplify it, nginx is -really- fast at deploying static assets, but it can't parse the ruby. Unicorn does that, so nginx passes those requests off to it.
[18:52:47] tubbo: maletor: i just used Enumerable#reject to filter out the refunds you don't need, and reduce([]) to turn each hash of attrs into an actual object. though i don't believe you actually need that step, you just need to pass in an array of hashes.
[18:52:58] tubbo: maletor: what you are doing is basically the ORM side of what accepts_nested_attributes does.
[18:53:36] FooBarWidget: amortimer_mbp: yeah, what terrellt said. and "unicorn" can be replaced by other alternatives, like puma, thin, passenger
[18:53:48] maletor: tubbo: ya it's not exactly easier to read...Do you think so?
[18:53:49] FooBarWidget: they are all app servers for running ruby
[18:54:20] FallLine: anyone know how to query authlogic's sessions by user (id or login name)? The table itself doesn't expose those fields, so I assume it's somehow encoded
[18:54:49] amortimer_mbp: I just heard about puma today, from this room. I'm thinking about assessing it for our projects.
[18:54:57] tubbo: maletor: perhaps it's not easy to read, but it's certainly easier than what you had before. if you had methods encapsulating some of that shit it would be very easy to read
[18:55:10] tewlz: https://gist.github.com/dgmcguire/c4506adc7cc4f4710fac
[18:55:14] tewlz: having ajax problems
[18:55:22] tewlz: getting 404 when clicking the element
[18:55:29] terrellt: amortimer_mbp: I had a hell of a time getting a maintainable puma stack up, but just because Unicorn has more examples.
[18:55:30] tewlz: probably just a bad route
[18:55:49] FooBarWidget: terrellt: hm? puma and unicorn are almost the same, usage-wise
[18:55:54] FooBarWidget: what problems did you have?
[18:56:32] terrellt: FooBarWidget: Just config stuff. Their options are just a tad different, or they were at one point. It was also before I had a good set of practices set up, so I imagine it would be easier now.
[18:56:57] maletor: alright, well thanks tubbo b
[18:57:06] revans: anyone having issues with rails 4 assets, specifically images with a SCSS file not showing up, even when using image-path
[18:57:17] amortimer_mbp: I have no real grounds for switching, other than the chart on the puma site says it's way faster.
[18:57:27] revans: image, within SCSS file*
[18:57:32] terrellt: Just do your own benchmarks.
[18:57:32] amortimer_mbp: So it looks like a good move.
[18:57:39] FooBarWidget: amortimer_mbp: be careful with those kinds of benchmarks
[18:57:54] FooBarWidget: they do not represent real workloads
[18:58:03] terrellt: Puma's good at being threaded.
[18:58:09] terrellt: That's about the only difference.
[18:58:11] FooBarWidget: yeah but threading doesn't always help you
[18:58:20] FooBarWidget: basically, benchmarks like these test how fast the app server can do nothing
[18:58:33] FooBarWidget: so if you app performs anything at all, the speed difference go away
[18:58:34] tubbo: maletor: i almost think it should go like this https://gist.github.com/tubbo/a5de6305cb7165f382ee
[18:58:39] FooBarWidget: and you almost don't notice a difference
[18:58:39] tewlz: it takes me forever to do nothing
[18:58:45] terrellt: Unless you're doing blocking IO.
[18:58:49] tewlz: in fact I spend like 3/4 of my day just to get nothing done
[18:59:04] FooBarWidget: yes, that's the only case in which puma, or passenger in threaded mode, is advantageous
[18:59:09] tubbo: puma's got a super fast startup time
[18:59:09] FooBarWidget: otherwise it doesn't matter
[18:59:17] FooBarWidget: puma's startup time is the same as unicorn
[18:59:26] FooBarWidget: in other words, 95% of the startup time is dominated by rails
[18:59:35] FooBarWidget: puma/unicorn/passenger all start in ~200 msec
[18:59:37] toretore: every real web app does quite a bit of blocking io
[18:59:41] terrellt: You only eat that cost once anyways, rolling restarts ftw.
[18:59:47] toretore: it is the single slowest part of the app
[18:59:53] tubbo: i like puma because it doesn't take a lot of configuration to make it work well, and i can use it in both dev and prod
[19:00:18] tewlz: i like webrick because it's even easier to set up for dev!
[19:00:30] tubbo: yeah but it's so slooow
[19:00:36] FooBarWidget: wait, don't people use pow anymore?
[19:00:46] amortimer_mbp: We use thin in dev.
[19:00:52] terrellt: I don't hear it much, FooBarWidget
[19:00:59] tewlz: yeah? Would changing to a better dev app server drop my panties or is it just some gains here and there?
[19:01:00] FooBarWidget: it was very popular for a while
[19:01:01] terrellt: I'm on a windows machine, so I certainly don't.
[19:01:05] tbuehlmann: guess it was a joke, right?
[19:01:17] tubbo: FooBarWidget: lol because it doesn't fucking work
[19:01:27] FooBarWidget: what do you mean, doesn't work?
[19:01:58] terrellt: tewlz: I'm not sure what the benefit is really. If I did it, it would just be so that my dev matched my production.
[19:01:59] tubbo: FooBarWidget: it fails randomly and in weird, unexpected and sometimes hard-to-debug ways. it causes slowness and it makes you think there's something wrong with your app. code sometimes doesn't reload. the DNS server used to break down all the time, requiring all kinds of hacks and extra configuration.
[19:02:07] toretore: writing `rails s` isn't much work, and you have better control and oversight
[19:02:10] tubbo: FooBarWidget: honestly, way too much engineering for a relatively simple problem.
[19:02:38] tubbo: like it's *cool*, when it works. but most people i know who use/used Pow have given up on it after a while...just got tired of the random and agonizing failures
[19:03:00] tubbo: FooBarWidget: yeah, taking way too long to fulfill a request. you make the request, rails doesn't see it for another 20-30 seconds while Pow figures out where to route it.
[19:03:16] FooBarWidget: are you sure that's not just pow trying to start your app?
[19:04:05] tubbo: FooBarWidget: i thought of that, but it would typically happen after i had been refreshing the page a lot. it seemed like i had a "quota" of a given number of refreshes before pow would start breaking down.
[19:04:13] toretore: i had weird problems with pow too
[19:04:34] tubbo: FooBarWidget: so maybe pow is restarting my app in the middle of all that? even so, i felt like pow wasted more of my time than it saved.
[19:05:37] tubbo: the idea is great, though...i think the concept could certainly be applied to a "personal docker" of sorts, where instead of running virtualboxes you would run containers and they'd be tied together by a pow-like DNS server of *.dev domains
[19:06:03] tubbo: but if they all lived in separate containers there'd be no need to manage state of all these apps...all you'd need is that little DNSMasq-like server
[19:11:14] tewlz: terrellt: makes sense
[19:14:44] bricker`work: Do people still use Pow? It is so unnecessary.
[19:22:18] FooBarWidget: anybody using docker on vagrant?
[19:22:31] FooBarWidget: we released docker-friendly vagrant boxes: http://blog.phusion.nl/2013/11/08/docker-friendly-vagrant-boxes/
[19:24:53] diegoviola: I have a Company model that has validates_uniqueness_of :subdomain, that works fine but i want to add some js/jquery code that will also validate via a blur() (when the input loses focus), basically some ajax thingy to also validate via js, do i need additional code in the server-side to do this? what do you guys suggest?
[19:28:31] erichmenge: FooBarWidget: Can you explain docker to me in pigs and bunnies?
[19:30:32] tubbo: erichmenge: it's like a VM except you share the resources of the host machine in a non-rigid way
[19:30:46] erichmenge: tubbo: Expand on that?
[19:31:14] FooBarWidget: are you familiar with chroot?
[19:31:18] FooBarWidget: or freebsd jails?
[19:31:33] erichmenge: Familiar in the sense I know what they are, I've never setup a jail though
[19:31:52] FooBarWidget: docker is like freebsd jails for linux
[19:32:13] tubbo: so instead of 4 VMs which all have 2GB of RAM each, regardless of whether that's used or not, they all report as using the same amount of resources because they are.
[19:32:18] FooBarWidget: and therefore much lighter than a virtual machine
[19:32:24] tubbo: erichmenge: but yeah, it's essentially a more complicated chroot.
[19:32:44] tubbo: sure you have, every iPhone is a jailed Darwin :)
[19:33:13] tubbo: that's where "jailbreaking" comes from. you are literally installing software on the root level to "break out" of the chroot that your phone has so lovingly placed you in
[19:33:47] erichmenge: what the shit is this? default debian installation nano is my editor
[19:34:02] tubbo: that's fucked
[19:34:32] tubbo: thought nano as the default editor was an ubuntu thing
[19:34:50] chobbit: Hi, I'm trying to set up Ruby on Rails for ubuntu. In this tutorial: http://kvz.io/blog/2010/09/21/ruby-with-nginx-on-ubuntu-lucid/, it tells me to paste the commadn mongrel_cluster_ctl restart && /etc/init.d/nginx reload; tail -f log/*.log, but it comes up with no such file for the .log file
[19:35:09] chobbit: Also, it has this error: /var/lib/gems/1.9.1/gems/thin-1.6.1/lib/thin/daemonizing.rb:129:in `send_signal': Can't stop process, no PID found in tmp/pids/thin.3002.pid (Thin::PidFileNotFound)
[19:36:27] erichmenge: FooBarWidget: So the idea would be you'd use this container to manage all dependencies/etc so you could easily deploy to any environment?
[19:37:15] stringoO: I'm using a user entered field in email subjects, but ampersands seem to be converted to '&amp;' - any way I can avoid this?
[19:37:53] tubbo: stringoO: .html_safe
[19:38:06] chobbit: Anyone have a fix for my issue?
[19:39:05] stringoO: tubbo - can you explain what's happening? because the string just has '&' in it in the database
[19:40:06] chobbit: I think &amp is some sort of HTML character
[19:40:12] chobbit: Such as %20 in titles instead of spaces
[19:40:33] stringoO: true chobbit
[19:40:45] chobbit: http://www.utexas.edu/learn/html/spchar.html
[19:41:04] FooBarWidget: erichmenge: it's a sane default
[19:41:12] chobbit: Now, can anyone help me? >_>
[19:41:15] FooBarWidget: nano is my editor of choice when on the command line
[19:41:50] csaunders: FooBarWidget: lolwut?
[19:42:25] csaunders: I always get messed up by the keybindings in nano. I'd use emacs but the default config always has those silly backup tilde files
[19:42:32] FooBarWidget: erichmenge: as for the container, there are many uses. you could install everything in the container and deploy the container itself
[19:42:38] tubbo: stringoO: rails escapes all strings by default before rendering, to prevent XSS attacks. to mark a string as "html-safe", that is, so Rails won't try to escape characters in it, you need to add that little method onto the end.
[19:42:43] FooBarWidget: it's like developing on a VM and shipping the VM into production
[19:43:03] stringoO: tubbo & chobbit, I think i figured it out - the html_safe prevents rails from converting & to '&amp;' - it basically declares the string as being safe to display.
[19:43:08] tubbo: FooBarWidget: you need to learn you some vi :P
[19:43:11] stringoO: thanks for the tip tubbo !
[19:43:17] FooBarWidget: it also has other uses. for example our continuous integration system treats docker as a lightweight temporary VM. it spawns a container, runs unit tests in it, deletes the container. no junk left behind
[19:43:38] FooBarWidget: tubbo: csaunders: the key bindings are written right there on the screen
[19:43:39] tubbo: that's what i want to implement here, FooBarWidget.
[19:43:43] tubbo: a CI server based on containers
[19:43:44] FooBarWidget: they're so easy
[19:43:48] FooBarWidget: nothing to remember
[19:43:57] FooBarWidget: tubbo: https://github.com/phusion/apachai-hopachai
[19:43:59] csaunders: FooBarWidget: whatever I do what i want ;)
[19:44:00] tubbo: FooBarWidget: i guess if you don't edit on the command line all the time
[19:44:09] FooBarWidget: I don't. I use sublime text
[19:44:11] csaunders: I think it's a muscle memory thing from emacs :P
[19:44:17] FooBarWidget: the command line is for compiling and gdb and stuff
[19:44:20] tubbo: FooBarWidget: ugh that is an AWFUL name dude. :P
[19:44:34] FooBarWidget: tubbo: no dude, apachai is a cool guy
[19:44:50] chobbit: I can't seem to be able to start thin
[19:44:50] FooBarWidget: one of my favorite characters
[19:45:07] chobbit: Firefox can't establish a connection to the server at
[19:45:08] tubbo: you know sometimes i want to name my projects after things i like
[19:45:09] lexi87: Quick question. I am using Thinking Sphinx for zip codes. Should the zip code column be a varchar or integer?
[19:45:22] tubbo: FooBarWidget: but i don't feel like THE_KVLT_ARMY_OF_BLACK_GRINDCORE is a great gem name
[19:45:28] chobbit: Firefox can't establish a connection to the server at
[19:45:41] chobbit: when it says Starting server on ...
[19:45:49] tubbo: chobbit: try localhost:3000 :)
[19:45:54] tubbo: it just says that
[19:46:21] chobbit: Firefox can't establish a connection to the server at localhost:3000.
[19:46:22] FooBarWidget: tubbo: the software is not as mature as travis, but already works. we use it on our system for continuously testing Passenger Enterprise
[19:46:26] chobbit: As well as
[19:46:43] FooBarWidget: and the command line name is only 'appa', so there's not much typing for you ;)
[19:46:48] tubbo: FooBarWidget: we currently use BigTuna as a CI here. but the problem we have with it is that it's no longer supported, and sometimes is annoying.
[19:47:10] FallLine: can anyone tell me if it's possible to query for all sessions by user in authlogic?
[19:47:37] tubbo: FooBarWidget: did you attempt to download and install Travis locally before making this?
[19:47:49] tubbo: because i always thought Travis was based on VMs.
[19:49:08] chobbit: How can I fix it not being online?
[19:49:15] chobbit: Firefox can't establish a connection to the server at localhost:3000.
[19:49:23] nobitanobi: What's the correct way of checking for associated objects? @page has_many prices. @page.prices.any nopes, what should I use?
[19:49:24] chobbit: It says that it's hosting on
[19:49:27] FooBarWidget: tubbo: no. there is no good documentation for installing it locally
[19:49:35] tubbo: FooBarWidget: yeah, that was the same problem i had.
[19:49:38] FooBarWidget: everything looked too big and daunting to me
[19:49:47] FooBarWidget: besides, I didn't want to spend a lot of money on a multiple VM setup
[19:49:47] makerop: nobitanobi, @pages.prices
[19:49:54] FooBarWidget: I wanted something that fits on a VPS
[19:49:56] nobitanobi: just if @pages.prices ?
[19:50:03] tubbo: i want to just lock myself in a room with sven fuchs and figure it all out :D
[19:50:11] nobitanobi: *@page.prices
[19:50:15] tubbo: because i believe travis is a better CI than anything out there
[19:50:57] chobbit: I'm following this tutorial, anyone know why it doesn't work? It says it started it but it doesn't work, localhost:3000 isn't working. http://kvz.io/blog/2010/09/21/ruby-with-nginx-on-ubuntu-lucid/
[19:51:02] FooBarWidget: if you define "CI" as "automatically runs your unit tests", then yes travis is by far the best option I've seen
[19:51:16] tubbo: could also be a build tool :)
[19:51:20] tubbo: travis that is
[19:51:20] FooBarWidget: jenkins look quite complex, and its UI is a mess, but it has so many features
[19:51:34] FooBarWidget: lots of things that I can't do on travis
[19:51:52] tubbo: FooBarWidget: like what? i like Jenkins actually, we use it at work and it "just works".
[19:52:01] tubbo: we use a combo of BigTuna and Jenkins.
[19:52:22] FooBarWidget: well for example, I want my CI server to build and release binaries but only for commits that represent a new release, not on every commit
[19:52:35] tubbo: chobbit: can you access localhost:3000 from your browseR?
[19:52:42] FooBarWidget: how do I do that on travis? jenkins looks like it could actually do that
[19:52:55] chobbit: tubbo: no, it says it's not able to connect
[19:52:58] chobbit: i already said that
[19:53:08] FooBarWidget: but jenkins doesn't look like something that gives me an isolated environment by default, so it's kinda useless to me for running unit tests
[19:53:13] FooBarWidget: I need to run unit tests as root
[19:53:17] tubbo: FooBarWidget: makes sense. travis is a CI. jenkins is actually an automated build server. it does CI for free, because to be an auto build server you have to be a CI too.
[19:53:35] tubbo: FooBarWidget: you can run jenkins remotely, on VMs. that's how we do it.
[19:53:44] tubbo: we have CI set up for certain devices which need hardware
[19:53:49] chobbit: No? Anyone?
[19:53:53] tubbo: chobbit: then nginx won't be able to either.
[19:53:59] tubbo: chobbit: is thin running?
[19:54:14] chobbit: tubbo: yes
[19:54:23] tubbo: chobbit: hmm, got any weird firewall rules? check iptables?
[19:54:30] jarr0dsz: hi, any sql guru;s around here? recently switched from mysql to postgres trying to fix this query https://gist.github.com/anonymous/0c8c0a48003bc5611401 but not sure how, any suggestions why pg chokes on this?
[19:54:31] chobbit: Starting server on ...
[19:54:34] chobbit: Thin has successfully started the server and is tracking changes to log files.
[19:54:40] tubbo: chobbit: it's on :3002...
[19:54:42] chobbit: kickstart.log contains the text "Thin has success.."
[19:54:43] tubbo: not :3000
[19:54:47] chobbit: tubbo: yeah, sure
[19:54:58] tubbo: chobbit: yeah well, if you go to localhost:3000 then it won't work lol
[19:54:58] chobbit: [start] /etc/thin/test.concerned.lan ...
[19:55:01] chobbit: Starting server on ...
[19:55:02] chobbit: Starting server on ...
[19:55:36] tubbo: hmm, not sure what you're doing here but you should be able to at least hit one of those guys on your local box with either or localhost:3000, chobbit.
[19:55:49] tubbo: chobbit: check your iptables/firewall settings, make sure nothing's blocking :3000
[19:55:50] chobbit: I know, but it's not working..
[19:56:14] FooBarWidget: phusion passenger's market share has risen to 350 000 websites :D
[19:56:17] chobbit: How do I check my iptables/firewall?
[19:56:20] FooBarWidget: last year around this time it was only 150 000
[19:56:59] tubbo: chobbit: oh one thing about that article...it's from 2010 and i know both of those projects have evolved considerably
[19:57:11] terrellt: FooBarWidget: I keep tellin' ya man, free to educational institutions and it could be a lot more. ;D
[19:57:15] chobbit: Yes, but it should still work, no?
[19:57:35] FooBarWidget: terrellt: the open source version is free ;)
[19:57:38] tubbo: chobbit: possibly, but the config might be slightly different. if you have a railscasts account, you might want to review some of the casts about it http://railscasts.com/episodes?utf8=%E2%9C%93&search=nginx
[19:57:41] terrellt: And useless to me!
[19:57:48] tubbo: they deal with other ruby app servers but the nginx config should be the same or similar
[19:57:54] terrellt: Useless is too strong a word, but I try not to lose features.
[19:57:56] FooBarWidget: though educational institutions get a discount on the enterprise version
[19:58:07] chobbit: No railscast account
[19:58:14] chobbit: Is there a link to the new configuration stuff?
[19:58:21] terrellt: I'll bite. Tentatively. What is it? Don't send me to sales, please.
[19:58:22] chobbit: I really don't want to redo this all with passenger
[19:58:48] tubbo: chobbit: haha that's not necessary. your problem isn't the server, it's got to do with something on your machine. i'm not sure how to check your firewall b/c i don't know your OS
[19:59:00] FooBarWidget: you don't have to redo with passenger. passenger has a standalone mode
[19:59:01] chobbit: Ubuntu... As I stated before.
[19:59:12] FooBarWidget: run `passenger start -p <some port>` and it behaves exactly like mongrel/thin
[19:59:19] tubbo: chobbit: sorry you must be in a rush, but i didn't see your message about ubuntu being your oS>
[19:59:23] FooBarWidget: and you can keep your reverse proxy configs
[19:59:27] tubbo: chobbit: in that case run `iptables -L` to see your firewall settings
[19:59:30] stringoO: cohabit - have you tried starting the server on a different port?
[19:59:49] tubbo: pretty sure that's how you do it on ubu
[19:59:52] stringoO: chobbit: you can do this by using 'rails s --p 3002'
[19:59:56] chobbit: input/output/forward all policy accept
[20:00:17] tubbo: chobbit: https://help.ubuntu.com/community/IptablesHowTo
[20:00:41] tubbo: chobbit: also...try just doing `rails server` instead of whatever script you're using to start multiple servers like on 3001, 3002, etc.
[20:00:49] chobbit: rails new APP_PATH [options]
[20:00:50] tubbo: chobbit: once we get this one config working we'll move on to getting the rest of them
[20:00:57] chobbit: tubbo: it's using nginx/thin
[20:01:08] tubbo: chobbit: i know, but rails server will run thin.
[20:01:20] chobbit: tubbo: and how do i do that >_>
[20:01:33] tubbo: chobbit: ...you run `rails server`, and if you have `gem 'thin'` installed it will just detect that.
[20:02:05] chobbit: rails new APP_PATH [options]
[20:02:08] chobbit: And then a bunch of help stuff
[20:02:14] terrellt: You misspelled server.
[20:02:25] terrellt: Was it the r? It's usually the r for me.
[20:02:45] tubbo: chobbit: make sure `which rails` is pointing to the right place.
[20:02:50] tubbo: should *NOT* be /usr/bin/rails iirc.
[20:02:52] chobbit: chobbit@concernedlaptop:~$ rails server
[20:02:59] tubbo: chobbit: also is this a rails 3 app or a 2.3?
[20:03:22] chobbit: Rails 4.0.1
[20:03:25] terrellt: "bundle exec rails s"? =O
[20:03:26] chobbit: ^ my rails version
[20:03:37] chobbit: as presented by /shell
[20:03:51] tubbo: chobbit: from the root of your app, type ./bin/rails server :)
[20:04:06] tubbo: from rails 4 onward, the "right" binary lives in ./bin/rails, iirc.
[20:04:35] chobbit: /var/lib/gems/1.9.1/gems/execjs-2.0.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
[20:04:44] chobbit: and no, its bin/rails
[20:04:49] chobbit: no such directory as .bin
[20:05:01] chobbit: or ./bin/rails
[20:05:20] terrellt: ./ just means "current directory"
[20:05:22] chobbit: wait, yes ./bin/rails works
[20:05:26] chobbit: but it just returns the error
[20:05:27] tubbo: yeah you mistyped it dude
[20:05:34] chobbit: /var/lib/gems/1.9.1/gems/execjs-2.0.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
[20:05:40] terrellt: chobit: sudo apt-get install nodejs
[20:05:43] tubbo: chobbit: ok, so what does that msg tell you
[20:05:51] chobbit: No JS Runtime
[20:05:55] tubbo: chobbit: yeah read the whole thing
[20:05:56] chobbit: but its using 1.9.1 gems >_>
[20:06:03] tubbo: chobbit: 1.9.1 == every 1.9.x gem
[20:06:03] chobbit: i uninstalled it using aptget
[20:06:06] tubbo: it's weird :D
[20:06:09] chobbit: but im using 2.x
[20:06:11] tubbo: don't worry about it your ruby is probably right
[20:06:16] chobbit: ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]
[20:06:20] tubbo: chobbit: i'm not sure if ruby 2.x changed that
[20:06:24] chobbit: it used to be 2.x
[20:06:31] chobbit: it switched back
[20:06:41] tubbo: what are you using to abstract ruby? rbenv?
[20:06:51] chobbit: nvm, i never installed ruby 2
[20:06:55] chobbit: just rails 4
[20:07:06] chobbit: let me check logs
[20:07:08] jrhorn424: I've been asked to find a commit that caused a change on a codebase I'm completely unfamiliar with. any suggestions on how to start? https://github.com/rails/rails/issues/12802 cc: Radar
[20:09:51] chobbit: didnt upgrade to ruby 2
[20:10:30] terrellt: Yeah, so don't worry about it for the moment.
[20:11:06] chobbit: installing nodejs
[20:11:46] AntelopeSalad: i think see why you guys recommended sidekiq over resque the other day
[20:12:20] AntelopeSalad: that .delay method seems like the most useful thing ever created in the history of queues
[20:12:40] terrellt: chobbit: High five.
[20:12:41] chobbit: the WEBrick server works
[20:12:50] bricker`work: jrhorn424: I might know the problem, which delayed job version are you using?
[20:13:04] terrellt: AntelopeSalad: Sidekiq is quite cool.
[20:13:06] chobbit: Thanks guys!
[20:13:26] chobbit: going to webdev now
[20:13:40] chobbit: you've been very helpful. thanks again
[20:13:47] AntelopeSalad: terrellt: i'm a little concerned about the crashing issue tho
[20:13:54] AntelopeSalad: but i'm not sure if resque handles it better
[20:13:56] terrellt: AntelopeSalad: Wat?
[20:14:08] AntelopeSalad: it seems like you need to pony up $750 if you want your jobs to be safe from sidekiq crashing
[20:14:15] FooBarWidget: I wonder whether people could use a fullstack VM image with ruby, bundler, nginx, passenger etc already preinstalled
[20:14:24] FooBarWidget: it looks like lots of people are having problems with it
[20:14:27] tubbo: chobbit: no problem. hey for the future, realize that this is a scrollable chat session so we can definitely see you. but we can only type so fast :D
[20:14:33] chobbit: Uhh... is rails generate supposed to default to rails new?
[20:14:41] AntelopeSalad: because it removes it from redis as soon as it gets prepared to run, if sq crashes at that point then you're screwed because you will lose the job
[20:14:44] chobbit: The welcome page says to run rails generate but it returns rails new stuff
[20:14:46] jrhorn424: bricker`work: 4.0.0. I had the same problem with comfortable-mexican-sofa, thought it must have been rails
[20:15:30] terrellt: AntelopeSalad: You probably shouldn't be pushing code through sidekiq that's gonna crash, or is that important. If you are, well, then maybe $750 is the right route.
[20:15:58] AntelopeSalad: terrellt: well, imagine you want to do something super common like delete 50 AR records or bulk update a bunch of records
[20:16:10] AntelopeSalad: or keep your elastic search index in sync with AR
[20:16:12] chobbit: edit: nvm, i wasnt running it in my rails project dir
[20:17:01] AntelopeSalad: those are the main things i planned to use sidekiq for but if it crashes, it's really out of my control, the code being ran is not really mine, it's being ran through the methods supplied by rails and other libs
[20:17:04] csaunders: Failed jobs in resque/sidekiq get added to a failed queue
[20:17:08] csaunders: they can be recovered
[20:17:24] AntelopeSalad: csaunders: sidekiq's readme says otherwise
[20:17:39] csaunders: Unless you are talking about the server actually dying
[20:17:41] AntelopeSalad: it's not about failed jobs too, it's sidekiq crashing
[20:17:47] csaunders: well then you're fucked
[20:17:59] csaunders: use delayed job I guess
[20:18:00] AntelopeSalad: if sidekiq is like "oh hi, i'm going to do job #123", it'll remove it from redis and then execute the job
[20:18:07] csaunders: though it's shitty and doesn't scale at all
[20:18:11] AntelopeSalad: if it crashes executing that job, you're dead
[20:18:31] AntelopeSalad: i wonder if resque offers protection against that scenario?
[20:18:33] csaunders: you are looking at one kind of small edge case here
[20:19:15] AntelopeSalad: i thought resque's mechanism was different, perhaps it only removes it from redis once it's tagged as complete?
[20:19:25] AntelopeSalad: but i didn't check the source code to double check that
[20:19:33] makerop: if the job fails, or the server fails?
[20:19:40] csaunders: makerop: server
[20:19:42] AntelopeSalad: the actual resque worker
[20:20:00] makerop: workers can be restarted
[20:20:16] makerop: and pick up jobs on the que
[20:20:34] makerop: (im 90% sure) it has been awhile
[20:20:44] AntelopeSalad: that sounds like resque will handle itself crashing without losing the job
[20:20:47] makerop: but I def remember my workers dying a lot, and restarting jobs
[20:20:59] csaunders: AntelopeSalad: You need to provide a solid example. Is this like??? "I couldn't get a response from this server so I died" or is this "Oh man the process running resque/sidekiq died, thereby killing all it's children"
[20:21:16] makerop: ya, that's an important question
[20:21:36] AntelopeSalad: it's sidekiq dying mid-job process
[20:22:09] AntelopeSalad: i don't have an actual solid example because crashes tend to come at unpredictable times
[20:22:49] csaunders: you're going to need to read the resque source then to see what it does with a job once it pops it off a queue
[20:23:09] terrellt: https://github.com/resque/resque/issues/758
[20:23:12] terrellt: Open issue.
[20:23:13] AntelopeSalad: all i know is, i read this https://github.com/mperham/sidekiq/wiki/Error-Handling#process-crashes
[20:23:25] AntelopeSalad: that clearly states with sidekiq you're SOL unless you pay him $750
[20:24:03] csaunders: AntelopeSalad: It's something he's deemed as a pro/enterprise feature
[20:24:11] terrellt: RPOPLPUSH is only used in Sidekiq Pro, from what I can see. Understandably, dude has money to make.
[20:24:11] csaunders: if it's that serious to you, then pay for it.
[20:24:27] csaunders: It's cheaper than building it yourself
[20:24:38] csaunders: Or just roll without it and see if it ever becomes an issue
[20:24:47] AntelopeSalad: it seems like durable queues are in resque 2.0 from that ticket
[20:25:42] csaunders: no, they are a planned feature
[20:25:56] AntelopeSalad: yeah from a year ago
[20:26:18] terrellt: Open ticket, no 2.0 branch.
[20:26:24] csaunders: and it's not closed, so it's not implemented yet
[20:26:43] AntelopeSalad: fair enough, although i think it would be reasonable to say it's a feature that'll make it to 2.x?
[20:27:38] AntelopeSalad: it seems like a serious concern tho because a lot of people say to use a worker for any external http calls
[20:27:51] AntelopeSalad: what if you want to accept payments and you use a payment processor to handle your transactions?
[20:28:06] AntelopeSalad: i would feel very uncomfortable using a worker that will just drop jobs if it crashes
[20:28:10] terrellt: Woah woah woah.
[20:28:14] terrellt: That is a terrible example.
[20:28:47] AntelopeSalad: probably, but if you're making an external call to xyz API to validate a CC transaction wouldn't you use a worker to do that?
[20:28:52] terrellt: What are you going to do, -assume- it worked? Assume it didn't? Are you going to have a callback? Sidekiq is an asynchronous processor, not a shortcut to an event driven architecture.
[20:29:01] csaunders: Just an FYI, if the worker crashes there's probably a good chance it didn't validate
[20:29:07] csaunders: besides you need to still capture the transaction
[20:29:18] csaunders: but yeah, you can update the information based on the response
[20:29:33] bricker`work: AntelopeSalad: you're saying resque drops jobs if the worker crashes? Sorry, just seeing this conversation.
[20:29:41] makerop: ya, you probably wouldnt want to use a worker to process a transaction lik ethat
[20:29:42] csaunders: Shopify does all it's payment processing in Resque
[20:29:50] csaunders: using resque
[20:29:56] csaunders: and we process a lot of orders
[20:30:07] AntelopeSalad: bricker`work: nope, sidekiq does unless you buy the pro ver, i was wondering if resque did too
[20:30:13] terrellt: Are you storing the status in redis and pushing status over websockets?
[20:30:25] csaunders: ACTION takes a breath.
[20:30:44] bricker`work: AntelopeSalad: since everything is persisted in redis, it doesn't drop anything.
[20:30:49] csaunders: Alright, so we have this thing that actually processes the credit cards (using resque as well)
[20:30:53] AntelopeSalad: i wonder why shopify chose to use resque over sidekiq too
[20:30:56] bricker`work: AntelopeSalad: I thought that was also the case in sidekiq?
[20:30:58] AntelopeSalad: maybe sidekiq wasn't around then?
[20:31:22] terrellt: bricker`work: That's not entirely true. When it -gets- the job, it pops the info out of redis. If it then falls apart, it's out of redis.
[20:31:27] csaunders: we then fire up a background worker to initialize the transaction (that'll do all the start the auth and all that jazz)
[20:31:35] AntelopeSalad: bricker`work: it does, but sidekiq pops it off redis then tries to execute it, if it crashes when doing it, then you lose it --unless-- you buy the pro ver
[20:31:51] makerop: csaunders, is your state saved though?
[20:31:57] csaunders: we then store some identifying information somewhere (can't remember where)??? I think it's checkout id
[20:31:59] makerop: adn the job just reads the state to process?
[20:32:29] csaunders: We know the job is done once we have created a transaction for the order
[20:32:36] terrellt: csaunders: How do you handle the workflow though? Does the customer get put in some sort of "transaction pending" status?
[20:32:37] FooBarWidget: if you're worried about durability of the work queue, you should use something that uses AMQP
[20:32:50] csaunders: terrellt: exactly
[20:32:52] FooBarWidget: disabling auto-ack does exactly what you want
[20:32:59] csaunders: "we are processing your order" *spinner*
[20:33:10] csaunders: and we use JS or whatever to query an endpoint every N seconds
[20:33:16] FooBarWidget: if the worker does not acknowledge the processing of the job, the AMQP broker will put it back in the queue
[20:33:20] makerop: I wrote a resque job that would hit rackspaces' API to spin up a VM, and would check every 30 seconds gainst their api until the VM was "running"
[20:33:24] FooBarWidget: state is saved on disk for durability
[20:33:27] terrellt: csaunders: Gotcha. Use something better than polling though man, this is 2013.
[20:33:33] makerop: the jobs failed alot, but I was able to respawn them where they left off
[20:34:04] csaunders: terrellt: It's simple and gets the job done. We have heruistics on how long it takes to process an order
[20:34:05] terrellt: FooBarWidget: You know, you make a good point. Message queues have been solving these problems for a long time, why are people turning redis into one?
[20:34:10] AntelopeSalad: makerop: i think that's a different situation, that is the job failing, not the resque process
[20:34:18] csaunders: so by the time the first call has been made the order is probably processed by then
[20:34:25] makerop: AntelopeSalad, it's a resque worker
[20:34:52] makerop: if the parent resque process fails, that's a different story
[20:34:52] FooBarWidget: terrellt: because redis is cool
[20:35:04] AntelopeSalad: oh, it sounded like the job itself failed, not resque itself
[20:35:06] FooBarWidget: and redis feels simpler
[20:35:22] csaunders: FooBarWidget: Nah it really isn't :P
[20:35:25] makerop: AntelopeSalad, the resque worker child process
[20:35:28] FooBarWidget: although I have to admit, rabbitmq sometimes gives me headaches
[20:35:34] makerop: the program, that looks for code to run
[20:35:37] csaunders: Resque is a bit complicated
[20:35:37] makerop: those failled all the time
[20:35:40] csaunders: I need to use rabbit sometime
[20:35:41] FooBarWidget: but for what it's supposed to do it does it quite well
[20:35:58] AntelopeSalad: csaunders: what made you guys pick resque over sidekiq btw?
[20:36:08] csaunders: sidekiq didn't exist at the time
[20:36:09] terrellt: Sidekiq's pretty new, is my guess.
[20:36:12] AntelopeSalad: for something as large as shopify i don't think $750 matters haha
[20:36:28] csaunders: shopify is like??? almost 10 years old or something
[20:36:42] AntelopeSalad: for a toy project that has like 6 users and no income then $750 is kind of a lot
[20:36:51] csaunders: Then why do you care?
[20:37:08] AntelopeSalad: because i like doing things in a way that would work under higher load and still be confident
[20:37:15] AntelopeSalad: but i guess at that point then $750 wouldn't matter
[20:37:49] csaunders: Dunno, I'd look into a different avenue like what @FooBarWidget suggested if you really want a more resilient system
[20:37:58] csaunders: oh wow??? fail
[20:38:00] AntelopeSalad: yeah i've been following what he wrote
[20:38:22] AntelopeSalad: that does seem a bit overkill
[20:39:35] AntelopeSalad: i would love to be able to say "well, we had 250 million transactions today and we lost 8 of them, time to move to rabbitmq"
[20:41:50] AntelopeSalad: thanks for the feedback guys, i'll just stick with sidekiq for now and re-evaluate as necessary
[20:43:17] FooBarWidget: guys, rabbitmq is not some huge complicated system
[20:43:23] makerop: AntelopeSalad, dont over-engineer scaling
[20:43:28] FooBarWidget: it's easy to install, almost no setup required
[20:43:37] FooBarWidget: add rabbitmq's APT repo, apt-get install rabitmq-server, done
[20:43:50] FooBarWidget: is not harder to use than redis. it's just one daemon that runs
[20:43:50] toretore: there's no such thing as overthinking system design
[20:43:53] FooBarWidget: uses only a few MB of memory
[20:44:04] makerop: probably heresy in a channel like this, but if your goal is to build something to make money
[20:44:12] makerop: there is much more important stuff to focus on
[20:44:27] makerop: (unless my assumption, I gathered from your tone, is wrong)
[20:44:30] toretore: yeah, gotta pivot fast!!
[20:44:46] toretore: no time for all this thinking bs
[20:44:57] makerop: ...yes, that's what I said
[20:44:59] makerop: dont think.
[20:45:01] csaunders: makerop: Sounds kinda true
[20:45:47] makerop: if your goal is to learn systems, and engineering etc, disregard my advice
[20:45:52] csaunders: You can still build good systems, and if you know about the limitations you can address them later
[20:45:57] csaunders: there's that :P
[20:46:05] toretore: thinking about what happens when your resque or sidekiq worker crashes is hardly over-engineering
[20:46:33] FooBarWidget: I agree with toretore
[20:46:36] makerop: i would argue for 99% of web apps it is
[20:46:40] FooBarWidget: crash handling is not a new problem
[20:46:45] FooBarWidget: it's done for decades now
[20:46:53] FooBarWidget: there are well known and well understood solutions and approaches
[20:46:56] toretore: people who don't consider these things are not good developers
[20:47:18] FooBarWidget: saying that crash handling is not important for 99% of web apps is like saying transactions are not important for them
[20:47:22] FooBarWidget: and the result is??? MyISAM
[20:47:56] FooBarWidget: and I'm sure you guys all remember the little PHP apps that are prone to SQL injections
[20:48:02] FooBarWidget: it's the same line of thinking
[20:48:31] toretore: it's all fine to move fast, as long as you're aware of the cost
[20:48:43] toretore: which most people severely underestimate
[20:48:54] FooBarWidget: that's what I've been stable. stable doesn't have to be slow
[20:49:15] FooBarWidget: doing proper crash handling with rabbitmq is literally a matter of setting two flags to true
[20:49:33] AntelopeSalad: FooBarWidget: how hard is it to integrate into a rails project tho?
[20:49:35] voidbottle: hey hey!!! i just wrote my second recursive function and it's works! :) yay ayay yay :)
[20:49:49] voidbottle: yay yay ay ! :) i am happy!)
[20:49:51] FooBarWidget: AntelopeSalad: no, because I have a rails app that uses rabbitmq. what's the problem?
[20:50:15] AntelopeSalad: FooBarWidget: no problems as of yet
[20:50:15] toretore: FooBarWidget: do you use the amqp gem inside rails?
[20:50:17] FooBarWidget: sorry I read your project wrong
[20:50:23] FooBarWidget: I read your sentence wrong
[20:50:26] FooBarWidget: <??? not awake today
[20:50:38] AntelopeSalad: but the implementation with sidekiq and resque seem really simple, you just setup a class and use your active record models as necessary
[20:50:43] csaunders: toretore: the major thing to be careful of is having your system in a consistent state, regardless of result.
[20:50:49] FooBarWidget: toretore: I use the bunny gem. the amqp gem assumes an EventMachine environment while bunny has a nice blocking API
[20:51:05] csaunders: i.e. if the job fails midway through you don't have a completed order but have captured a payment
[20:51:07] toretore: csaunders: exactly. and to do that you must take into account failures
[20:51:45] toretore: FooBarWidget: yeah.. but isn't it very outdated?
[20:51:49] AntelopeSalad: my transaction example was probably bad, it was off the top of my head and i actually never setup a real payment processing system
[20:52:05] toretore: somebody read that blog post about transactions today
[20:52:05] FooBarWidget: it was. then I forked it and improved it and fixed some things. and then some other guys took over maintenance
[20:52:06] csaunders: yeah for sure, but you shouldn't be relying on resque/sidekiq for your consistency. It just queues up workers. Maybe you could have a processing queue or something
[20:52:08] lethjakman: is there a way to use the migration generators to automatically create a table without an ID?
[20:52:09] FooBarWidget: nowadays it is very active
[20:52:32] toretore: FooBarWidget: ah, good. it's been a while since i had a look at it
[20:52:35] terrellt: FooBarWidget: Do you have an example somewhere of workers using RabbitMQ/Bunny?
[20:52:48] FooBarWidget: well, no open source example
[20:52:53] terrellt: FooBarWidget: I imagine I'd have to write a ruby file that included rails that gets called every once in a while.
[20:52:55] FooBarWidget: our Union Station uses RabbitMQ and bunny
[20:53:17] toretore: don't think about it in terms of "workers". it's just a matter of sending messages out of your rails app
[20:53:20] FooBarWidget: we wrote a little daemon that spawns a bunch of threads, each listening on an AMQP queue
[20:53:28] FooBarWidget: then processes whatever messages come in
[20:53:29] toretore: what happens after that is the responsobility of th eworker
[20:54:07] csaunders: FooBarWidget: And how do you requeue the message during failure in the case that AntelopeSalad is talking about?
[20:54:27] FooBarWidget: we don't. we call the Bunny::Queue#pop method with :no_ack => true
[20:54:29] csaunders: you just have a queue for success messages and if the message for that job never comes in you assume it's failed?
[20:54:34] FooBarWidget: then we process the message
[20:54:35] terrellt: FooBarWidget: Does your daemon include your Rails environment for the models and such?
[20:54:40] FooBarWidget: and then we call Bunny::Queue#ack
[20:54:41] csaunders: ah, then you pop it after success?
[20:54:54] FooBarWidget: we pop it immediately, but with a flag
[20:55:05] toretore: terrellt: don't load the rails env unless you absolutely have to
[20:55:08] FooBarWidget: that flag tells the broker, "if you don't receive an ack from me, put it back in"
[20:55:17] FooBarWidget: we send the ack only after we've processed the thing
[20:55:42] csaunders: oh so it's the broker doing all that work
[20:56:18] FooBarWidget: yes. the acknowledgement thing is part of the protocol
[20:56:21] nvll: Is nginx + passenger is ok for Rails?
[20:56:22] terrellt: toretore: Seems reasonable, unless you need database interaction, no? I mean, obviously you could spin up your own queries, but yeah.
[20:56:30] FooBarWidget: nvll: yes, very good choice
[20:56:38] csaunders: FooBarWidget: you've sold me on rabbitmq for something I want to use :P
[20:56:49] toretore: terrellt: i would rather do direct sql
[20:57:01] toretore: loading the rails env kind of defeats the whole purpose
[20:57:08] bricker`work: lethjakman: `create_tab :foobar, id: false` I think
[20:57:19] lethjakman: bricker`work: yeah you're right, I just wana do that with the generator :)
[20:57:44] lethjakman: nvll: lol wrong time to ask. FooBarWidget works with passenger. however I highly recommend it, it's my choice.
[20:58:06] bricker`work: lethjakman: editing the migration file too much work?
[20:58:21] lethjakman: bricker`work: nah, just thought a flag would be nice.
[20:58:31] lethjakman: well...I am a programmer....which means I'm lazy.
[20:58:36] FooBarWidget: nvll: you have my money back guarantee :)
[20:58:45] nvll: Is passenger + nginx better than unicorn?
[20:58:49] lethjakman: rather than repeating a task I'd almost always rather automate it.
[20:58:57] nvll: I'd link to deploy my rails app on VPS
[20:58:59] bricker`work: lethjakman: not possible https://github.com/rails/rails/blob/master/activerecord/lib/rails/generators/active_record/migration/templates/create_table_migration.rb
[20:59:00] lethjakman: nvll: I came from unicorn, passenger seems to run better.
[20:59:08] FooBarWidget: nvll: each option has its own strengths and weaknesses
[20:59:10] toretore: nvll: it's likely to be easier
[20:59:28] bricker`work: lethjakman: you could, of course, write the generator yourself
[20:59:33] FooBarWidget: one of passenger's main strength is ease. it's very focused on making things simple
[20:59:35] nvll: thanks for help
[20:59:41] lethjakman: bricker`work: ahhh that was my next step. thank you :)
[21:00:07] lethjakman: I may at some point. wonder if they'd accept an option if I added it in.
[21:00:25] lethjakman: FooBarWidget: have you tried puma?
[21:00:28] bricker`work: lethjakman: I doubt it. They would tell you to just edit the migration file.
[21:00:36] FooBarWidget: lethjakman: yes, what about it?
[21:00:44] lethjakman: FooBarWidget: just curious what you thought about it.
[21:01:00] FooBarWidget: lethjakman: this sums up my thoughts: https://github.com/phusion/passenger/wiki/Puma-vs-Phusion-Passenger
[21:01:21] lethjakman: ooo perfect.
[21:02:21] lethjakman: didn't realize the open source was multi process.
[21:03:14] csaunders: lethjakman: passenger is an easier system to use eh? You what??? touch a text file and it knows new code is available?
[21:03:31] csaunders: I've normally just done nginx + thin/unicorn deployments
[21:03:49] lethjakman: csaunders: lol pretty much. it's a very nice solution.
[21:04:25] FooBarWidget: I should create a new demonstration screencast. the new website doesn't have one :(
[21:05:23] FooBarWidget: lethjakman: you might also want to watch https://vimeo.com/77539358
[21:05:55] FooBarWidget: this is a talk I gave at RubyConf Brasil 2013 about passenger. it explains where passenger comes from, what problem it solves and how its philosophy and design differs from e.g. unicorn and puma
[21:06:05] FooBarWidget: and explains the advanced features in passenger
[21:06:21] nvll: Is it possible to validate length only if it is present?
[21:06:37] nvll: I'm using Rails 4.0.1 + Ruby 2.0.0
[21:06:52] FooBarWidget: nvll: use the :allow_blank => true option
[21:07:02] csaunders: FooBarWidget: You on the passenger team?
[21:07:06] FooBarWidget: csaunders: yes
[21:07:36] csaunders: Oh wait, I remember someone mentioning you yesterday. You're in Europe right?
[21:08:16] lethjakman: FooBarWidget: how did you handle cross platform programming with Passenger? did you just use standard system libraries?
[21:09:06] FooBarWidget: well, we limit our support to unix only, so that makes things easier
[21:09:17] FooBarWidget: if we have to support windows we have to rewrite almost everything
[21:09:23] FooBarWidget: these days windows is the only odd duck out there
[21:09:27] FooBarWidget: everything else is unix
[21:09:50] nvll: Developing Rails applications on Windows is nightmare
[21:09:50] FooBarWidget: passenger also doesn't have a lot of dependencies
[21:10:02] lethjakman: csaunders: another thing I noticed about passenger is I liked the error messages better.
[21:10:11] FooBarWidget: the dependencies we have are simple
[21:10:17] FooBarWidget: and we vendor them to make installation easy
[21:10:29] FooBarWidget: but besides that, it's a lot of disciplined coding
[21:10:38] lethjakman: FooBarWidget: I definitely agree with that. kinda sucks you're not on windows, but vagrant definitely takes care of it.
[21:10:41] FooBarWidget: despite all the unices being unix, there are lots of things that can go wrong
[21:10:44] arcanez: are there cirumstances where AR would specify a value for a column it knows is auto_increment not null?
[21:11:00] FooBarWidget: I happen to be able to make passenger run on many platforms because I've been coding C++ for a decade
[21:11:15] bricker`work: arcanez: if it had a default value specified
[21:11:18] lethjakman: FooBarWidget: really? very nice.
[21:11:32] FooBarWidget: it's certainly not easy though. things break regularly (new OS releases for example) but we fix them quickly too
[21:11:45] arcanez: bricker`work: do you mean that the id was set on the model prior to save?
[21:12:08] lethjakman: FooBarWidget: I haven't had a problem with it for over a year now.
[21:12:23] FooBarWidget: that's great, that's what it's supposed to do :)
[21:12:27] bricker`work: arcanez: I don't think I understand your question. I was saying that if the column has a default value specified, active record honors that, and in fact fills in those values for you when you do `MyModel.new`
[21:12:38] pushpak: FooBarWidget: just curious , how did you come up with such a awsome nick ? :P
[21:13:00] FooBarWidget: all the other nick names I could come up with were taken, so I had to pick one that I thought nobody would use
[21:13:13] FooBarWidget: and then I was reminded of the name of some GNOME Panel widget
[21:13:26] toretore: yes, foobar is indeed very creative ;)
[21:13:39] FooBarWidget: foobar is taken, but the -widget part not so much :p
[21:13:56] arcanez: bricker`work: in my underlying table, id is int(11) NOT NULL AUTO_INCREMENT.. and unless I do m = MyModel.new; m.id = 1; it shouldn't put a value in the INSERT and allow the auto_increment to do it's job, correct?
[21:14:34] bricker`work: FooBarWidget: [no creepy] I love your github picture.
[21:15:26] lethjakman: FooBarWidget: is that you?
[21:15:42] lethjakman: lol that's what I love about the internet. you never know what to expect.
[21:16:06] bricker`work: arcanez: that's correct.
[21:16:22] lethjakman: great picture.
[21:18:42] FooBarWidget: it's one of the privileges new york had given me :)
[21:18:53] FooBarWidget: my friend happened to be carrying a good camera at that time
[21:20:02] lethjakman: FooBarWidget: how old are you?
[21:22:33] toretore: got more pics??
[21:22:48] csaunders: stranger danger!!!!
[21:22:52] bricker`work: hopes? dreams? aspirations?? Home Address & SSN? :-|
[21:23:14] lethjakman: I've always thought railsporn.com would be pretty saucy...
[21:23:16] FooBarWidget: I live at the police station nearby you
[21:23:20] lethjakman: however....some people might take that the wrong way.
[21:23:23] FooBarWidget: come, I'll welcome you
[21:23:48] toretore: what are you in for? maybe i'll meet you tonight; depends on how drunk i get
[21:24:00] FooBarWidget: all the things I just mentioned are already public anyway :)
[21:24:11] kaneda^: hey all, i'm having trouble finding examples of solr sunspot with all_of statements in search, i'm trying to do boolean conjuctions of IDs to find intersecting results
[21:24:35] kaneda^: so with(:category_ids).all_of(id_list) <-- doesn't seem to work
[21:24:53] FooBarWidget: oh yeah, when you come visit me, make sure you wear a mask
[21:25:05] FooBarWidget: and knock on the door very loudly. ok?
[21:25:20] FooBarWidget: remember: police station near you ;)
[21:25:59] kaneda^: so if i select two categories i'd like it to find results that fall in both categories
[21:26:28] kaneda^: if i just do with(:category_ids, id_list) it will use OR, finding the union of the two results, i want the intersection
[21:28:09] lethjakman: kaneda^: sounds to me like you need a group by.
[21:34:36] kaneda^: bloody hotspot
[21:35:08] kaneda^: lethjakman: i dont see how a group by would help me, since i want to find the interesction of two result sets, not the grouping of the union
[21:35:53] lethjakman: kaneda^: you'd want to group by category_id and find any having a count greater than 1. am I misunderstanding you?
[21:36:18] kaneda^: well, right now it's esentialy doing the search select * from foo where category_id in [1,2,3,4]
[21:36:33] kaneda^: i want it to say select * from foo where category_id = 1 and cateogry_id = 2 and cateogry_id = 3 ...
[21:36:42] kaneda^: excuse the spelling, i'm typing faster than my net is keeping up
[21:37:02] csaunders: category_id: [1, 2, 3] should work
[21:37:23] csaunders: what you want is select * from doodle where category_id in (1, 2, 3)
[21:37:35] csaunders: which where(category_id: [1, 2, 3]) should cover
[21:37:38] kaneda^: csaunders: no, that's an OR, the union, i want AND, the intersection
[21:38:29] csaunders: across two tables?
[21:38:53] kaneda^: sure, with an association, in this case many-to-many
[21:38:55] csaunders: do an inner join
[21:39:14] kaneda^: this is solr sunspot on rails we're talking about
[21:39:21] csaunders: ??\(??_o)/??
[21:39:25] kaneda^: the table joins are not an issue, the logic of sunspot is what i'm wondering about
[21:40:01] csaunders: does sunspot have an IRL channel? That might be a more appropriate place to ask??? unless it's barren
[21:40:04] kaneda^: lethjakman: going back to what you said, a group statement would just give me the grouping of the category, not what i'm looking for
[21:40:54] csaunders: that was the case for one person who was having a problem with apache & rails. The channels were empty so they stopped here
[21:40:55] lethjakman: kaneda^: I see what you're saying now. I have no clue how to turn that OR into an AND. possibly appending multiple where statements?
[21:41:13] kaneda^: lethjakman: so that's what i was afraid of, i'll have to metaprogram to accomplish this?
[21:41:26] kaneda^: i can wrap all of them individually within a all_of statement
[21:41:44] kaneda^: like all_of { with(:category_ids, [1]); with(:category_ids, [2]).... }
[21:41:54] kaneda^: that seemed like a poor way of doing it though
[21:42:57] kaneda^: i'm going to provide an option to choose or or and in the category list, and make a switch to unwrap that in metaprogramming, which sucks
[21:43:10] kaneda^: lethjakman: thanks for your help, laters
[21:44:30] csaunders: I don't think you'd need to metaprogram it that much
[21:45:34] csaunders: you could just pull something off like exploding :category_id => [1???n]
[21:45:49] csaunders: or maybe even make an array the size of your category_ids
[21:46:15] csaunders: that just contains 'category_id = ?', and join(' AND ') them
[21:46:35] csaunders: Thing.where(your_category_string, *category_ids)
[21:46:49] csaunders: or did he leave?
[21:47:04] lethjakman: csaunders: he's gone.
[21:47:30] csaunders: maybe it's for the better? Don't know if my solution is good or not :P
[21:47:33] lethjakman: I know, didn't seem like THAT bad of a problem to me. a little unfortinate it's not included.
[21:51:49] AntelopeSalad: in the "writing thread safe code" section of sidekiq's readme, he mentions to use instance methods instead of class methods whenever possible -- is it going to be a problem if i have a class method being called in a sidekiq worker?
[21:53:59] csaunders: if you modify state, yes
[21:54:26] AntelopeSalad: csaunders: what do you mean by state in this case?
[21:54:40] AntelopeSalad: in my example i'm performing bulk updates of many instances by either updating them or deleting them
[21:55:00] AntelopeSalad: ex. bulk delete 15 articles, or change xyz field from abc to def
[21:55:48] csaunders: class methods are global
[21:56:03] csaunders: if two threads modify it you get into inconsistent state and your stuff will break
[21:56:30] csaunders: class attributes*
[21:56:36] AntelopeSalad: so i can't use a worker to mass delete/update records?
[21:57:18] paniwani: my users frequently get timeouts when uploading images via carrier wave to amazon s3. is there something i'm not optimizing correctly or is it just a fact that the task is intensive and should be done in a background process to avoid timeouts?
[21:57:25] csaunders: Should be able to. You are calling destroy_all on an ARel
[21:57:37] csaunders: but I don't know enough about AR to confirm that confidently
[21:57:43] AntelopeSalad: csaunders: would it matter if i'm using delete_all vs destroy_all?
[21:58:09] AntelopeSalad: i'm using destroy_all in this case because i need some callbacks to fire but i'll eventually use delete_all when i get better with elasticsearch
[21:58:12] bricker`work: That matters, those are two different methods
[21:58:32] AntelopeSalad: yeah i know they do different things, i'm just talking about thread safety differences for when i put them in a queue
[22:00:03] AntelopeSalad: i never had to deal with thread safety before, i don't use class variables anywhere tho
[22:00:45] paniwani: any help? getting timeouts when uploading images via carrier wave to amazon s3 (hosting on heroku)
[22:03:16] rhizome: what do you mean by "timeout"?
[22:03:47] bricker`work: AntelopeSalad: did it really say to use instance *methods* instead of class *methods*? Or did it say variables?
[22:04:26] AntelopeSalad: bricker`work: "Always prefer instance variables and methods to class variables and methods"
[22:04:37] AntelopeSalad: https://github.com/mperham/sidekiq/wiki/Problems-and-Troubleshooting#writing-thread-safe-code
[22:06:54] bricker`work: AntelopeSalad: Oh, I guess it makes sense. Two threads could be running the same class method at the same time and cause problems.
[22:07:02] tubbo: makes sense to me, an instance gives you certain memory-space gaurantees.
[22:07:04] tubbo: guarantees*
[22:07:18] AntelopeSalad: bricker`work: the unfortunate thing is, the only thing i want to run in a sidekiq worker are 2 class methods
[22:07:28] AntelopeSalad: because they take forever to finish
[22:07:44] AntelopeSalad: it's like 5 seconds to delete 25 records from AR on a micro instance
[22:07:58] paniwani: rhizome: the image fails to load and the user sees an error page. in my logs it says the request timed out
[22:08:00] tubbo: i wish sidekiq had a GIL :P
[22:08:02] AntelopeSalad: same goes for updating a single property
[22:08:13] tubbo: "when this job is running, don't do anything else" :P
[22:08:34] AntelopeSalad: maybe since what i'm doing is not thread safe it's the wrong tool for the job?
[22:09:27] AntelopeSalad: the confusing thing to me is i heard "rails 4 is thread safe?!?!" all over the place, maybe rails 4 has me covered?
[22:11:12] smathy: Thread safe just means that the internals of Rails are thread safe, it doesn't mean that Rails will magically protect your class state (ie. globals) from infecting other threads.
[22:11:48] AntelopeSalad: smathy: in this case my class method is just calling activerecord methods
[22:12:32] AntelopeSalad: Article.where(id: article_ids).destroy_all ? true : false , that is wrapped in a class method
[22:13:01] smathy: AntelopeSalad, doesn't mean much without seeing the rest of your code/setup.
[22:13:06] AntelopeSalad: the other one just .eaches through a collection of records, changes a field from x to y, then .saves it
[22:13:39] AntelopeSalad: smathy: what other components are necessary to view?
[22:14:46] smathy: A collection of Article records?
[22:15:27] smathy: AntelopeSalad, ...and, all of it. Rake task down to the model method.
[22:15:44] AntelopeSalad: smathy: yeah, here's the code for both https://gist.github.com/anonymous/7378538
[22:16:05] AntelopeSalad: the first method is a little hacky, the value comes from a form field so it's a string
[22:16:45] smathy: Right, so they're obviously able to overlap each other.
[22:16:54] AntelopeSalad: and i skip validating because it only runs when published is exactly "true"/"false", so i saved AR from having to validate 50 times when i know it's valid
[22:17:08] smathy: ...depending on what the caller of that is sending for article_ids
[22:17:31] Rafalski: hey guys, does SecureRandom.uuid create a unique value? if not, what's the best way to create a unique value?
[22:17:31] AntelopeSalad: those methods get called from a controller, and the article_ids value is an array of ids
[22:17:42] AntelopeSalad: that array gets populated from checkboxes in a form
[22:18:13] smathy: Rafalski, yes, "uuid" means "universally unique id"
[22:18:26] AntelopeSalad: in theory 2 people could attempt to bulk delete the same set of records
[22:18:32] AntelopeSalad: but that could happen without a queue
[22:18:40] Rafalski: smathy: thanks
[22:18:52] smathy: AntelopeSalad, yes it could.
[22:18:56] smathy: Rafalski, welcome.
[22:18:59] Rafalski: smathy: was just wondering based on the class name
[22:19:16] AntelopeSalad: smathy: can i use that code as is and not worry about it or is sidekiq going to go berserk?
[22:19:16] esaym153: what is the BEST rails book for rails3 or 4?
[22:19:35] esaym153: I don't just want beginner stuff either, I would like to know how the insides work
[22:22:06] smathy: AntelopeSalad, well .save will fail if the record disappears after it's retrieved but before it's `UPDATE`d
[22:22:18] smathy: Ie. it will raise an exception.
[22:24:27] AntelopeSalad: smathy: without a queue both tasks complete without error
[22:24:38] smathy: AntelopeSalad, most of the time.
[22:24:56] AntelopeSalad: i just opened 2 windows side by side and deleted 50 of the same records in each window
[22:25:10] AntelopeSalad: both reported back that they deleted 50 articles
[22:25:24] AntelopeSalad: (my controller flashes back how many got deleted and whether or not things were ok)
[22:27:46] AntelopeSalad: i wonder if this is a hint that my UI might be bad
[22:27:58] smathy: AntelopeSalad, you're telling me that you had two SQL deletes in t....oh, two of *those* windows ;)
[22:28:06] smathy: Yeah, open two console windows.
[22:28:24] AntelopeSalad: it's using destroy_all tho
[22:28:28] AntelopeSalad: it ran 50 queries
[22:28:48] smathy: It ran 50 queries?
[22:29:04] AntelopeSalad: yes, because i checked off 50 articles to delete -- that's why it takes so long to finish
[22:29:09] smathy: It should have just run one DELETE FROM articles WHERE id in (1, 2, 3, 4, whatever )
[22:29:19] AntelopeSalad: that's if you use delete_all, but that skips callbacks
[22:29:25] AntelopeSalad: i can't skip callbacks in my case
[22:29:31] smathy: Oh, look what you've done ;)
[22:29:45] AntelopeSalad: yeah, i'm depending on tire to keep my elastic search index in sync
[22:29:49] AntelopeSalad: and it does that through callbacks
[22:30:13] erichmenge: I don't know that I've ever had an antelope salad.
[22:30:37] smathy: AntelopeSalad, so anyway, once it has done one then it won't do it again.
[22:30:50] smathy: ...but two overlapping `DELETE`s shouldn't be a problem.
[22:31:01] AntelopeSalad: smathy: will sidekiq keep trying if it gets a RecordNotFound error?
[22:31:10] smathy: The problem will be when a record is read in for the _change_published loop, then deleted, then `.save`d
[22:31:11] AntelopeSalad: because the othe method does an update, not delete
[22:32:31] AntelopeSalad: smathy: hmm, i just tested that situation
[22:33:03] AntelopeSalad: i did: 1) delete article A , 2) try to change a propety on article A , that method in the gist returned true
[22:33:33] AntelopeSalad: maybe it's because i'm using save instead of save! so it doesn't raise an error?
[22:35:07] smathy: Naah, you're right actually. I'm surprised, but it works here too. .save returns true, so .save! wouldn't raise an exception either.
[22:35:44] AntelopeSalad: i would have thought it would throw a RecordNotFound too
[22:35:56] AntelopeSalad: so i guess in this case using sidekiq with those class methods is fine?
[22:36:16] smathy: Should be, yes.
[22:36:38] AntelopeSalad: i have to admit reading the testimonials on his wiki made me happy
[22:40:22] AntelopeSalad: thanks for walking through that with me smathy
[22:40:28] smathy: Using sidekiq (sidekiq pro for us actually) has been a great pleasure.
[22:40:35] AntelopeSalad: and erichmenge, don't worry about it, not too many people have
[22:40:45] smathy: Turns out you didn't need it, but it's good to know what you're looking for - for future.
[22:40:54] smathy: I'd like to eat an antelope.
[22:41:00] AntelopeSalad: smathy: i do need it tho
[22:41:07] erichmenge: AntelopeSalad: is it pretty tasty?
[22:41:10] smathy: Perfectly happy if someone wants to try to hide the meat behind salad.
[22:41:13] AntelopeSalad: those delete actions take a long time
[22:41:33] AntelopeSalad: also everytime i index something in elasticsearch it makes an http request, i'm going to move that into the sidekiq queue too
[22:42:11] AntelopeSalad: erichmenge: i wouldn't know, i never ate it
[22:42:33] smathy: A salad rarely eats itself.
[22:43:06] erichmenge: smathy: What about carnivorous plants?
[22:43:18] AntelopeSalad: the "rarely" is important because there's always an edge case right around the corner
[22:43:28] smathy: We have a complex PDF parsing, conversion, publishing, encryption, zipping thing that one of my best guys has just rewritten to be even more amazing than before.
[22:43:47] smathy: erichmenge, dead once they're in the salad though.
[22:43:58] smathy: Technicality I know, but I'll take it.
[22:48:16] erichmenge: smathy: Could be alive.
[22:49:04] Fick: I has a question. When I try to set a remote_avatar_url for muh users using carrierwave and this url https://secure.gravatar.com/avatar/9bfe411bed2a7662d19bd8ad53884117?s=400&d=identicon&r=PG, I get a "You are not allowed to upload \"\" files, allowed types: jpg, jpeg, gif, png" error from carrierwave. If the user has a gravatar already, it saves as a jpeg. Why is the image extension blank?
[22:59:52] Senjai`work: For the life of me all of a sudden i can't get Capybara to work
[23:04:16] Senjai`work: Getting visit undefined, any input? ttps://gist.github.com/Senjai/50bfb2739b8c12df2c4f
[23:04:27] Senjai`work: https://gist.github.com/Senjai/50bfb2739b8c12df2c4f
[23:10:08] bricker`work: Senjai`work: you need to put your feature specs under spec/features
[23:11:10] Senjai`work: bricker`work: They're in there
[23:12:52] Senjai`work: bricker`work: updated gist with the directory layout relative to /spec
[23:13:19] AntelopeSalad: smathy: are you still around?
[23:13:32] AntelopeSalad: do you guys use the .delay feature?
[23:16:15] bricker`work: Senjai`work: don't you need a "scenario" inside of a "feature" ?
[23:16:30] smathy: AntelopeSalad, nope, just perform_async stuff, we don't need the specific delays.
[23:16:57] AntelopeSalad: smathy: the .delay method seemed like an alternative to making a worker class
[23:17:10] Senjai`work: bricker`work: Yes, as my coworker just pointed out to me, that kind of day
[23:17:12] Senjai`work: thanks anywho
[23:17:30] AntelopeSalad: smathy: it seems weird tho, i don't think it's working for my activerecord method calls
[23:22:52] cwin: I'm trying why if I do something like??? post = Post.where(title: "first post")??? I can't follow that up with something like post.id
[23:23:09] AntelopeSalad: smathy: here is a proper gist explaining the situation https://gist.github.com/anonymous/7379259
[23:23:16] cwin: sorry, typo, I'm wondering*
[23:23:40] diggitydane2: cwin: cause that returns a relation as there could be many records that match your where
[23:23:49] diggitydane2: you'll need a .first on the end
[23:24:17] cwin: ah that's it
[23:31:35] tewlz: I can't for the life of me figure out why rake routes says I can access this action via user_relation_skills#item_ajax, but when I click a button that calls jquery '/user_relation_skills/item_ajax' it hits the show action instead...?
[23:31:37] tewlz: https://gist.github.com/dgmcguire/ea343959dfe5a87854d0
[23:32:20] tewlz: added the rake to the gist just now
[23:33:06] tewlz: adding the server log, one sec
[23:36:48] bricker`work: tewlz: maybe because you are not passing an id
[23:37:23] tewlz: bricker`work: would that be required to update a div in #show?
[23:38:08] bricker`work: tewlz: it is required to request the correct URL
[23:40:00] tewlz: bricker`work: so how would I pass that id back? and I assume I need to change my route to jsut -- get :item_ajax
[23:40:19] AntelopeSalad: tewlz: on line 3 in the routes file i'm pretty sure you can get rid of the "to" stuff
[23:40:32] bricker`work: tewlz: you need to get the ID in that javascript somehow
[23:40:37] AntelopeSalad: also in your .coffeefile doesn't the url have to start with /?
[23:40:39] tewlz: AntelopeSalad: I can, but then it builds a route that needs an id
[23:40:50] AntelopeSalad: (guessing on that one)
[23:40:51] tewlz: AntelopeSalad: I don't think i need the ?
[23:41:02] AntelopeSalad: not the question mark but the forward slash
[23:41:02] bricker`work: tewlz: if your route doesn't need an id, then put it under "collection", not "member"
[23:42:57] tewlz: bricker`work: that get's my server log calling the right action, thanks I'll play with that
[23:43:19] tewlz: bricker`work: totally glossed over and didn't even think about what member did... :(
[23:55:34] Nighthawk: noob here, can anyone offer any ideas on how to address this http://pastebin.com/PummkaPm
[23:57:52] Radar: Seriously.
[23:57:56] Radar: It's even in the rules
[23:57:57] helpa: https://gist.github.com/996779
[23:58:23] Nighthawk: git.github loads slower for me
[23:59:21] Radar: Are you going to put the code on Gist or Pastie or what?
[23:59:27] Radar: I have pastebin blocked on my local machine.
[23:59:52] Leighton: Nighthawk: it's worth your time to just use gist