« Back to channel list

#RubyOnRails - 20 August 2014

« Back 1 day Forward 1 day »
[00:00:00] beneggett: ok one second
[00:00:16] beneggett: so is it 1-1 or 1-M between foo and bar?
[00:03:10] zcreative: in order to create an admin panel do you recommend creating it as an engine?
[00:03:54] lilia: Bar has_many Foo
[00:04:09] makerops: zcreative, im not an expert etc, but from what i can tell, if you are going to reuse it, yes
[00:04:23] beneggett: zcreative: subjective question; all depeneds on your use case
[00:04:25] makerops: im in the process of builidng an extensive engine myself
[00:04:43] zcreative: I don't see myself reusing it except for this app.
[00:05:01] beneggett: then don't do the extra work up front; you could always extract it out later if needs be
[00:05:18] zcreative: Ok. then thats what i'll do!
[00:14:45] jshultz: this is probably something simple, i'm just not googling it right. i have a model, and it has an association with another model. i've got a form in a view that will contain a field for that model, and a field for the associated model. i'm not sure how to build my form correctly so that will work.
[00:16:07] contextio: you want to reference the variables in the form ?
[00:16:47] contextio: like form_for([@model, @model2]) do |f|
[00:16:53] contextio: that what your talking about
[00:21:06] jshultz: so, for example, i have scores, which is the main model
[00:21:25] jshultz: and then they can add comments to scores. and those live in score_notes
[00:21:35] jshultz: so in the form, there's a field for score, and then a field for score notes
[00:21:48] contextio: are you rendering partials ?
[00:21:53] contextio: or is it all on one page
[00:22:16] jshultz: it's in a modal window,.
[00:23:07] jshultz: so, it's sort of a partial, but what's happening, is they click the link and js renders it in a modal.
[00:23:13] contextio: k i mean if your posting a score then just doe the above and pass your fields like <%= f.text_field :score_notes, :class => 'text-field form-control' %>
[00:24:02] jshultz: would f.text_area work the same?
[00:24:32] jshultz: text_field is a single line and text_area isn't, i realize that but would the structure be the same?
[00:24:43] contextio: personally me and im no expert, i render partials for forms then use a create.js.erb or new.js.erb whichever function and pass remote to it so it does not refresh page
[00:25:01] contextio: yea the :score_note will be picked up in what your passing it too
[00:25:11] contextio: so just make sure your pulling that out in your create function
[00:25:53] jshultz: but score_note is the name of the model, how will it know that the field is for notes?
[00:26:21] contextio: whats the field you created ;)
[00:26:29] contextio: when you setup your migration
[00:26:35] contextio: then there ya go ;)
[00:27:06] contextio: ok so when you post it just use :notes
[00:27:26] contextio: and you really need to look at your controller not your modal so much
[00:29:13] contextio: your controller is going to do the work, the model is going to be all your classes defined
[00:29:16] jshultz: see, if i do it like that, i get this: https://gist.github.com/jshultz/8753c8819eb1ed0e79fc
[00:29:51] contextio: post your model, controller and form for me ill look real quick
[00:30:01] contextio: just the relavent parts
[00:31:21] jshultz: ok, i updated the gist
[00:32:23] jshultz: updated it one more time. i posted the wrong relationship
[00:33:20] contextio: ok where is your form ?
[00:33:26] contextio: or is that all you have in the top part
[00:33:40] jshultz: oh, one sec.
[00:34:22] jshultz: ok. updated with the form
[00:36:42] contextio: you might just try notes as you dont have score_notes defined
[00:36:59] contextio: ohh wait your grabbing it from the key
[00:37:37] jshultz: i tried it, got this: ActionView::Template::Error (undefined method `notes' for #<Score:0x007fdb07033e20>):
[00:40:34] jshultz: i thought maybe this might work:
[00:40:35] jshultz: https://gist.github.com/jshultz/6900d5018bdd08523336
[00:40:54] jshultz: but i get this: ActionView::Template::Error (undefined method `notes' for #<ActiveRecord::Associations::CollectionProxy []>):
[00:41:32] contextio: yea notes isnt defined at all
[00:41:37] contextio: so that wont work
[00:42:04] contextio: im not 100% sure , it seems simple your right to be honest but somethings not jiving
[00:46:13] jshultz: so i added accepts_nested_attributes_for :score_notes to my scores model
[00:46:43] jshultz: i changed that form field to look like this: https://gist.github.com/jshultz/6900d5018bdd08523336
[00:46:43] Matadoer: anybody here know about mongoid?
[00:46:54] jshultz: and now it doesn't show up at all. but it doesn't error either.
[00:54:18] jshultz: oh, i figured it out. :)
[00:56:59] helpa: Matadoer: Don't ask "does anyone use <thing>?". It's better to just state your problem and if anyone has used <thing> they will most likely answer.
[00:56:59] Radar: Matadoer: !used
[01:51:12] neruda: activesupport is throwing an "argument out of range" for a "timezone" on datetimepicker that has no timezone for a model field that also has no timezone, any ideas?
[01:51:20] helpa: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[01:56:13] soahccc: Hey guys, what does it need to not hit AR cache? I had the problem of serial keys being assigned to multiple orders (racing condition). So I tried to use with_lock but for some reason I always fetch the same record when retrying despite it not matching the where clause anymore (through multiple scopes)??? I tried to self.reload in line 10 but it doesn't help :/ https://gist.github.com/2called-chaos/1f5a033bf95abe62bd71
[01:58:08] mivv: If I have data that looks like this: https://gist.github.com/mvarrieur/d2ca79609cf7f7864e5d, how could I write a block that only takes the first 4 images it hits?
[01:58:33] mivv: So Jimmy's photos wouldn't be captured by the block I need to write
[02:00:14] kies: there might be a cleaner way but this comes to mind data.collect { |x| x[:photos] }.flatten(1)[0..3]
[02:02:06] mivv: kies: Thanks I'll try that
[02:06:54] rhizome: or query from the Photo side
[02:12:14] rickjamesthethir: So I am looking to create a pricing system that pulls prices from specific sites (maybe 2 sites) and runs it through an algorithm and updates the prices on my site accordingly. Is there any gems or guides that you guys know of that would point me in the right direction?
[02:12:37] rickjamesthethir: prices are going to be for the exact same items
[02:13:13] soahccc: How do I get rid of the cache? batch.serial_keys.available.first gives me always the same record. batch.reload has no effect (while calling it on the result has)
[02:28:48] soahccc: Nevermind, there is ActiveRecord::Base.uncached??{}
[02:43:25] geardev: ActionView::Template::Error (couldn't find file 'jquery' (in /home/vagrant/share/rails_challenge/app/assets/javascripts/application.js:13)):
[02:43:37] geardev: jquery-rails is in the Gemfile
[02:43:43] geardev: and i have ran bundle
[02:43:47] joelbrewer: hey folks, I've got a client that I've built a rails app for, but he wants me to add a pre-payment marketplace using braintree. I'm trying to write him a proposal for how long it will take. Any suggestions on how long this might take? Or things to consider when writing this proposal?
[02:44:21] geardev: oh, i had it in a group
[02:44:46] geardev: how do you tell rails to use multiple groups in the gemfile?
[02:45:02] pontiki: joelbrewer: the braintree hook-up takes about a day or two
[02:45:12] pontiki: the other part might take a bit longer, depending
[02:45:21] geardev: couldn't find file 'turbolinks'
[02:45:31] joelbrewer: pontiki: gotcha.
[02:45:44] geardev: oh, there is a gem called "turbolinks"
[02:45:46] geardev: installing
[02:45:46] pontiki: braintree is really easy to use, and they have pretty good docs
[02:45:59] joelbrewer: pontiki: sweet. I've used Stripe, but not braintree.
[02:46:04] pontiki: there's also a gem called ActiveMerchant
[02:46:12] pontiki: pretty much the same
[02:46:43] joelbrewer: pontiki: and setting up a marketplace (splitting payments and distributing to two parties) isn't too bad?
[02:46:44] pontiki: conceptually identical; same difficulty/ease of implementation
[02:47:08] pontiki: that would be the part i can't really answer
[02:47:18] pontiki: because that wasn't what i was implementing
[02:47:39] bratsche: I've used braintree and it's been pretty nice.
[02:47:40] pontiki: (i set up subscription premium services)
[02:47:46] joelbrewer: pontiki: it looks like braintree has a marketplace feature:https://www.braintreepayments.com/features/marketplace
[02:47:57] joelbrewer: pontiki: yeah, I used Stripe for the same thing
[02:48:20] axilaris: hi guys, i was wondering can i use link_to to not work and prompt the error when a certain condition is met. currently this is the only way i know how to prompt with link_to https://gist.github.com/anonymous/52e8bb3f78ae2be8a8ec
[02:48:40] pontiki: stripe, braintree, paypal and another merchant service were in contention
[02:49:12] bratsche: Last time I checked, Stripe and Braintree offer the same rates.
[02:49:25] pontiki: braintree won because of ease of implementation, ability to keep the user experience entirely on site, and the 48 hour turnaround time for payments
[02:49:30] bratsche: But one kind of nice thing about Braintree is that they give you the first $50,000 of processing for free.
[02:49:44] pontiki: stripe 7 days remittance, braintree is 2 days
[02:49:49] joelbrewer: bratsche: have you set up a marketplace app before?
[02:50:15] joelbrewer: bratsche: where you have payments split to two different end-users (master merchant and sub merchant) ?
[02:50:16] bratsche: joelbrewer: I have not used it for that. I was hoping marketplace would work for my app, but it didn't fit.
[02:50:44] joelbrewer: bratsche: ahh. did you use something else to build a marketplace?
[02:51:05] joelbrewer: bratsche: (now using marketplace in a general sense)
[02:51:11] bratsche: No, I ended up putting that app on hold and moved on to a new one. And the new one I'm just doing a regular recurrence model, no marketplace.
[02:52:04] bratsche: joelbrewer: The one I put on hold was intended where one user can pay another, like marketplace, but that it would be a subscription model. Neither stripe nor braintree support that.
[02:52:36] joelbrewer: bratsche: ahh, I see.
[02:52:41] bratsche: joelbrewer: And so trying to implement all of that on my app's side just turned out to be more work than I was willing to do.
[02:53:33] joelbrewer: bratsche: yeah, makes sense.
[02:53:35] pontiki: sorry, bratsche: what don't stripe or braintree support?
[02:54:32] geardev: i'm seeing a "welcome aboard page", the getting started guide says to do `rm public/index.html` to remove it, but there isn't a public/index.html page
[02:54:33] bratsche: pontiki: A subscription model between users in your app. So users B, C, D are paying recurring subscriptions to user A.
[02:54:46] geardev: page, file, whatever you want to call it
[02:55:23] bratsche: pontiki: You have to develop all the recurrence and bookkeeping in your app and do each payment as a single transaction.
[02:58:35] pontiki: i see, okay
[02:58:38] geardev: `map.root :controller => "plants"`
[02:59:05] sevenseacat: if youre in rails 4, there is no more public/index.html page
[02:59:06] geardev: inserting that within the config/routes.rb file cause rails to blow up with "undefined variable or method `map`"
[02:59:17] geardev: sevenseacat: thanks
[02:59:17] sevenseacat: you're looking at a guide for rails 2
[02:59:29] geardev: where is the rails 4 guide?
[02:59:32] pontiki: geardev: what the hell version of rails guies are you looking at???
[02:59:33] helpa: http://guides.rubyonrails.org/getting_started.html - Getting started with Ruby on Rails guide written by Mike Gunderloy
[02:59:33] sevenseacat: !gettingstarted
[02:59:45] geardev: i'm using 4.1.4
[02:59:58] pontiki: yes, but your documentation is the wrong version
[03:00:39] bratsche: Oh cool, 4.2.0 beta 1
[03:01:06] sevenseacat: yeah just saw that
[03:01:22] joelbrewer: geardev: you should also check out the rails tutorial :) http://www.railstutorial.org/
[03:01:23] pontiki: good news, for me, is that this 3.0 rails app getting upgraded to 4.1 is on the negotiations table!!
[03:01:33] sevenseacat: pontiki: huzzah!
[03:01:48] geardev: i'm good honestly, i've went through the guides about 3 times
[03:01:50] sevenseacat: i did a 3.0 upgrade not too long ago - its going to finally go into production today (in theory)
[03:01:56] bratsche: Adequate Record and Web Console sound cool.
[03:02:00] geardev: i made it halfway through that tutorial twice
[03:02:06] axilaris: hi any helpers here, just need an understanding on ujs for links/buttons. how do i prompt js alert error when a button is pressed if it doesnt meet certain conditions ?
[03:02:07] geardev: it's so long
[03:02:14] joelbrewer: bratsche: lol Adequate Record. I was at rails conf for his talk on that.
[03:02:16] pontiki: sevenseacat: did you jump straight up to 4 or did you take intermediary stages?
[03:02:21] yza: hey everyone
[03:02:32] bratsche: joelbrewer: Cool, cool. Where was it this time?
[03:02:38] joelbrewer: bratsche: Chicago.
[03:02:49] sevenseacat: pontiki: i did 3.0 -> 3.1.latest, 3.1.latest -> 3.2.latest, and i was going to go to 4.0.latest next but ran out of time :(
[03:02:56] bratsche: Nice. I went to RailsConf in Austin a year or two before.
[03:03:00] yza: im following this tutorial and im sort of confused when it says add capistrano to your apps gemfile are they assuming the app already resides on the server?
[03:03:02] bratsche: I guess two years before.
[03:03:12] joelbrewer: bratsche: yeah? Such a great time,
[03:03:15] pontiki: okay, that's what i recommended as well (except the running out of time bit)
[03:03:23] yza: sevenseacat blahhhhhh
[03:03:31] yza: sevenseacat thanks
[03:03:32] joelbrewer: bratsche: That was my first time going. (I only started working with rails a year ago though haha)
[03:03:57] sevenseacat: the 3.1 upgrade took the longest due to asset pipeline crazy and one chage to specs that made me need to rewrite 1000 tests
[03:04:09] sevenseacat: if it wasnt for that i wouldnt have run out of time >_>
[03:04:32] pontiki: yup; that asset pipeline thingie is looking steep.
[03:04:41] bratsche: joelbrewer: Everything is kind of slowing down now. I mean, looking at the 4.2.0 and one of the features is ActiveJob which doesn't really look that useful to me. It seems like basically a wrapper around Sidekiq.
[03:04:44] sevenseacat: it wasnt as bad as i was expecting tbh
[03:04:56] pontiki: the tests are in test_unit + shoulda + mocha + plus a whole lotta cucumber+capybara
[03:05:05] sevenseacat: best part was with the upgrade, i ended up deleting 40000 lines of shit code
[03:05:24] pontiki: yes, we're also looking at deleting a lot
[03:05:31] joelbrewer: bratsche: Yeah, seems to be that way. Are people migrating to other frameworks?
[03:05:42] pontiki: i don't know if it is shit code, but i like removing code
[03:05:56] bratsche: joelbrewer: I dunno. I think some people have. I kind of want to, but kind of don't. :)
[03:06:05] joelbrewer: bratsche: I'm working on a node app as well. That framework seems promising.
[03:06:09] sevenseacat: if you can point out something better, people will likely move
[03:06:11] sevenseacat: node is not better
[03:06:21] joelbrewer: bratsche: ruby is great though :)
[03:06:32] bratsche: joelbrewer: Yeah, that seems where a lot of people have gone. But not me, Node is about the last place I would willingly go.
[03:06:46] pontiki: node is different, and i think serves a different niche
[03:07:15] joelbrewer: pontiki: yeah. I'm using it to build an analytics dashboard.
[03:07:16] pontiki: rails keeps getting better
[03:07:18] yza: sevenseacat thanks for your quick reply thats all i needed to get me back on track :)
[03:07:22] bratsche: Even though Javascript is obviously inescapable, I just don't love it and I don't really want to subject myself to it on the backend. :)
[03:07:29] sevenseacat: people will either go to a) better languages to write frameworks or b) the same language that already has better frameworks
[03:07:33] sevenseacat: node/js is neither
[03:08:00] joelbrewer: sevenseacat: agreed.
[03:08:07] bratsche: That's basically how I feel. There are other languages I like better than Ruby now, but there aren't necessarily frameworks for them that I want to use yet.
[03:08:23] joelbrewer: bratsche: what languages?
[03:08:28] pontiki: bratsche: i quite agree
[03:08:42] bratsche: joelbrewer: Elixir and F# are the two that I'm most into right now.
[03:08:46] pontiki: i do like writing coffeescript a lot more than POJS
[03:08:50] sevenseacat: i'm very happy with ruby, but then again my range of skills is quite narrow.
[03:08:59] joelbrewer: bratsche: Elixir does look promosing.
[03:09:09] joelbrewer: bratsche: high support for concurrency
[03:09:30] pontiki: there's so many languages i want to learn, still
[03:09:47] joelbrewer: pontiki: lol I feel like every time I get on Hacker News I learn about another one
[03:09:51] sevenseacat: but i have to focus on getting better at the ones i already know, first
[03:10:10] bratsche: Clojure is really nice and probably has just as good of frameworks, but there's a different mindset in that community that rubs me the wrong way. So many little micro libraries, nobody wants to re-use things.. everyone in Clojure wants to be the person who makes the most amazingest thing ever.
[03:10:14] pontiki: wax on, wax off
[03:10:26] sevenseacat: i wouldnt call myself an advanced ruby dev
[03:10:36] joelbrewer: bratsche: yeah
[03:10:51] sevenseacat: and i need to get a lot better at js
[03:11:01] pontiki: my experience with the clojuremn community seems like they want to dig deep into computer science, theory of algorithms, theory of programming
[03:11:12] pontiki: i'm just not interested in that; i got my cs stuff out of the way
[03:11:19] joelbrewer: sevenseacat: using node is forcing me to get better at js -- one of the reasons I chose it for a project
[03:11:23] rickjamesthethir: So i'm not sure about the limitations of speed for a postgresql database but would my application be super slow with about 300 or so rows (about 10-15 columns) for pulling prices of items
[03:11:24] bratsche: joelbrewer: Oh, and the other thing I'm getting really into now is Rust. But not really for web devel, just out of curiosity. I'm kind of a long-time C and C++ user and that side of me is really interested in Rust.
[03:11:39] pontiki: i am enamoured of clojure because lisp was my first real in depth language
[03:11:43] sevenseacat: rickjamesthethir: not at all
[03:11:45] joelbrewer: bratsche: rust looks awesome!
[03:11:59] sevenseacat: unless you're pulling all 300 rows at once, in which case the slowness will be in rails, not in postgres
[03:12:30] sevenseacat: postgres is orders of magnitudes faster than what happens after you get the data from postgres
[03:12:43] rickjamesthethir: well the thing is the seller will put in what they have and it will spit out a price for example (iphone 5s 16gb goodcondition At&t) then it will search for a match in the database and return a price
[03:13:11] pontiki: offload as much of that to the database as you can, and speed won't be much of an issue for your application
[03:13:26] sevenseacat: yep, postgres will just return the matching rows
[03:13:28] rickjamesthethir: alright then thanks guys
[03:13:31] pontiki: as sevenseacat says, rails will be more of an issue. postgresql is quite performant
[03:13:32] sevenseacat: which you should really be paginating anyway
[03:13:42] sevenseacat: so you wont have anywhere near 300 records
[03:14:02] bratsche: joelbrewer: I kind of wish I was still a student. When I was in school I had so much time to work on open source stuff for fun. And Rust is so interesting and now is the perfect time to try to get into it. :)
[03:14:08] Sigma00: just load the whole DB on application load, man! /s
[03:14:40] sevenseacat: i often wish i was still a student, or had a job outside programming. then i could devote all my mental energies to programming things i enjoyed
[03:15:01] joelbrewer: bratsche: yeah. I wish I had done cs in school :) I coudln't spend time working on open source because I was busy learning biology..
[03:15:12] bratsche: Oh, except when I was a student I lived in a shitty $200 apartment in some ghetto Baltimore neighborhood and had to evade drug dealers on my way home from school. Maybe I don't want to be in school again after all. :)
[03:15:16] rickjamesthethir: the site is meant to be similar to gazelle.com in that users will input their device and it will give you a price
[03:15:29] rickjamesthethir: how old is everyone?
[03:15:48] joelbrewer: bratsche: ha. just watched a documentary on Baltimore -- 12 'o clock boys
[03:15:53] sevenseacat: thats not a question you typically ask a lady. but to answer, 29.
[03:15:59] bratsche: joelbrewer: Never seen it.
[03:16:40] joelbrewer: bratsche: yeah. It's about the dirt bike gangs that ride around town in packs doing wheelies.
[03:16:57] bratsche: I never saw that. But nothing would surprise me there.
[03:17:04] rickjamesthethir: Nice I'm 21. Does everyone work or are some of you guys self employed?
[03:17:13] joelbrewer: bratsche: ha.
[03:17:18] joelbrewer: rickjamesthethir: I'm self employed.
[03:17:22] pontiki: everyone all together? i'd guess about 10,000
[03:17:33] sevenseacat: i am a full-time ruby developer.
[03:17:53] capin: ^ must be nice ;D
[03:17:55] rhizome: self-employed people don't work
[03:18:08] rickjamesthethir: haha rhizome they work double
[03:18:17] bratsche: joelbrewer: One of my friends had this stupid little gas-powered scooter and one time he got chased by some gang of kids who were trying to steal it. The thing didn't go very fast and he only got away once he got over some hill and gravity helped him go faster than them. :)
[03:18:49] joelbrewer: bratsche: haha that's great.
[03:18:54] bratsche: I'm a full-time developer, but I don't do Ruby at work.
[03:19:06] pontiki: rhizome's right, we don't work. we just get paid to play. :)
[03:19:19] rickjamesthethir: lol pontiki what do you work on?
[03:21:42] rhizome: he wrote Yo
[03:21:59] pontiki: nono, rhizome
[03:22:04] rhizome: #thoughtleader
[03:22:05] pontiki: i wrote yo-yo da
[03:22:13] pontiki: and i'm a girl
[03:22:31] rhizome: bad me for playing irc probabilities
[03:22:32] sevenseacat: there are no girls on the internet. >_>
[03:22:34] pontiki: not that it really matters all that much in green and black text
[03:22:45] rhizome: yo yo da, the cellist's social network
[03:23:08] sevenseacat: but yeah, i typically presume people are male too.
[03:23:17] bratsche: Play in tune, you will.
[03:23:34] rhizome: dog the walk
[03:24:02] joelbrewer: sevenseacat: yeah, I do but I shouldn't :/
[03:24:14] bratsche: Have any of you used Phoenix for Elixir at all?
[03:24:16] sevenseacat: eh, you'll be right more often than not.
[03:24:33] joelbrewer: sevenseacat: yeah, in this field at the present time.
[03:25:08] sevenseacat: for the foreseeable future
[03:29:38] bratsche: Just sitting back and waiting for the twitterverse to blow up. You know it's going to happen soon.
[03:42:10] pontiki: sure, like everytime DHH farts
[03:46:03] bratsche: I figured more along the lines of some police in Ferguson doing something crazy.
[03:47:35] sevenseacat: they seem to be good at that
[03:54:50] pontiki: it comes a marvel that they don't seem to realize they keep digging themselves in deeper and deeper
[03:55:02] pontiki: and it becomes harder to step out with any dignity left intact
[03:55:25] pontiki: in the face of the MASSIVE human rights violations
[03:55:54] sevenseacat: i havent heard a lot of the details, but it sounds pretty fucked up.
[03:56:13] pontiki: nor have i, my daughter is riding on top of this mostly, but i haven't delved in
[03:56:38] bratsche: You'd think that now that everyone is watching them they'd at least pretend to be decent. But no, they seem to get worse every night.
[03:56:56] bratsche: Kind of makes you wonder what they're like when they don't have a bunch of press watching them.
[03:57:07] pontiki: scared, same as now
[03:57:20] bratsche: No, I mean the cops.
[03:57:27] pontiki: that's who i'm talking about, too
[03:57:52] pontiki: fear is driving them, ever onwards
[03:58:08] bratsche: They don't seem scared. They seem like they just don't give a shit about what anyone thinks.
[03:58:19] pontiki: that internal mental monolog "HOLYFUCKWHATNOWHOLYFUCKWHATNOW!!!"
[03:58:32] pontiki: i'm not apologizing for their behaviour
[03:59:30] bratsche: It seemed like they were doing better for like one day, then they lost their shit again and started attacking and threatening the press.
[03:59:35] pontiki: i was talking with someone 2 nights ago, a former wetwork person, and their mindset was just appalling
[03:59:58] pontiki: how they could never ever trust any PoC because of the Black Panthers
[04:00:30] pontiki: and while i can looks at that and say "holy bugfuck crazy", i can *also* understand the downstream logic based on the fear
[04:00:54] pontiki: they did well for one day when they were following the lead of the state patrol officer
[04:01:29] pontiki: and then they wigged out again, and his response was to facepalm and shake his head
[04:01:42] pontiki: he was trying, he was making a difference
[04:03:54] pontiki: i think this is somewhat an expected reaction, when the 800 pound playground bully gets attacked by a smaller kid, they smother that kid and teach them a lesson
[04:04:34] pontiki: this is not rails
[04:04:40] pontiki: let's leave off
[04:07:37] bratsche: Oh wow, I just noticed 4.2.0 beta 1 adds support for foreign keys!
[04:08:13] bratsche: I've been using foreigner, but it's something I've long been thinking should be added to Rails.
[04:09:55] sevenseacat: bratsche: thats big
[04:10:13] bratsche: Yeah, why is it in the "everything else" section?
[04:10:30] bratsche: That seems more valuable than ActiveJob to me.
[04:40:54] axilaris: anyone able to help me with this http://stackoverflow.com/questions/25396302/javascript-and-rails-interaction-onclick-request-a-rails-path
[04:43:40] sevenseacat: youre right in that its not good practice
[04:44:48] axilaris: sevenseacat: ok :) but how to do it ? sorry ujs thing has not gone into my head much... been dealing a lot with js a lot
[04:45:03] sevenseacat: i'm not going to teach people how to do bad things
[04:45:15] axilaris: ok then lets gointo ujs then
[04:45:36] axilaris: how do i do link_to to prompt an error but doesnt redirect to the link
[04:45:54] axilaris: http://stackoverflow.com/questions/25396137/rails-ujs-link-to-for-prompting-error-on-a-certain-condition
[04:48:15] yza: still stuck with this deploy :(
[04:48:17] yza: https://gist.github.com/christru/b3239d123c804b34d741
[04:48:36] yza: cant really decipher whats going wrong from the error
[04:49:50] yza: im missing bundler
[04:56:59] axilaris: this is probably the right technique
[04:57:00] axilaris: http://simonecarletti.com/blog/2010/06/unobtrusive-javascript-technique/
[04:57:23] jabbott: I'm getting this error: "ActionController::UrlGenerationError - No route matches {:action=>"checkLogin", :controller=>"welcome"};" but have this route: resources :welcome, :only => [:index, :show, :checkLogin] ... Furthermore in my controller I have a checkLogin method. What do I need to change to fix this?
[05:00:07] rvanlieshout: jabbott: what method are you trying to access and what method is displayed in 'rake routes'?
[05:02:35] jabbott: rvanlieshout: rake routes shows:
[05:02:43] jabbott: welcome_index GET /welcome(.:format) welcome#index welcome GET /welcome/:id(.:format) welcome#show root GET / welcome#index
[05:03:10] jabbott: I'm trying to access method checkLogin
[05:03:21] rvanlieshout: jabbott: use gist and that part of the routes doesn't show a checkLogin
[05:03:28] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[05:03:28] rvanlieshout: !gist your routes.rb and output of rake routes
[05:04:42] jabbott: https://gist.github.com/comdexxsolutionsllc/2af7b1f7528a408a27fe
[05:05:26] jabbott: using : <%= link_to "login", controller: "welcome", action: "checkLogin" %> in the view
[05:05:43] rvanlieshout: there is no checklogin in your routes
[05:06:03] rvanlieshout: and use check_login, not checkLogin
[05:06:09] rvanlieshout: so add a check_login collection get route
[05:06:36] rvanlieshout: you didn't add it correctly to your routes.rb, but that part is missing in the gist
[05:07:45] jabbott: I have resources :welcome, :only => [:index, :show, :check_login] in routes
[05:07:53] rvanlieshout: yeah and that's wrong
[05:08:27] jabbott: What's correct? :)
[05:10:49] rvanlieshout: http://guides.rubyonrails.org/routing.html#adding-more-restful-actions
[05:25:17] Cache_Money: Is there a prefered way to validate the uniqueness of an attr so long as that attribute is not nil?
[05:25:40] root3d: Cache_Money, :unique
[05:26:35] Cache_Money: root3d: I have `validates :username, uniqueness: {case_sensitive: false}` but I got an error saying the username was already taken (it was nil)
[05:26:58] Cache_Money: another record had nil for the username. I only want to validate uniqueness if it's not nil
[05:27:15] rvanlieshout: Cache_Money: add an if
[05:27:19] rvanlieshout: Cache_Money: or unless
[05:27:51] Cache_Money: rvanlieshout: is this the Rails way? `validates :username, uniqueness: {case_sensitive: false}, if: 'username.present?'`
[05:28:50] rvanlieshout: Cache_Money: in a different syntax yes
[05:29:28] Cache_Money: what would you change?
[05:29:49] rvanlieshout: the way you provide the if
[05:29:53] pontiki: if: ->(user) { user.username.present? }
[05:29:54] rvanlieshout: so that it works
[05:30:42] Cache_Money: pontiki: thanks
[05:32:57] pontiki: would it be better to use unless: ->(user) { user.username.blank? } ?
[05:33:07] rvanlieshout: doesn't matter
[05:33:44] yza: i wish i could of used heroku
[05:33:53] rvanlieshout: heroku is really really expensive imo
[05:33:57] yza: working through these errors are annoying
[05:34:02] yza: you probably right
[05:34:03] sevenseacat: really really, if you want good service
[05:34:04] pontiki: take a look at dokku
[05:34:13] rvanlieshout: and i don't like the way they (mis)use git for deployment
[05:34:37] sevenseacat: i dont mind that
[05:34:52] rvanlieshout: it's not a showstopper, but not comfortable with that (yet)
[05:34:53] sevenseacat: but having to do things like add extra gems just for heroku is silly
[05:37:20] yza: failing these deployments like a boss
[05:37:29] yza: atleast im moving forward with new errors lol
[05:38:21] yza: getting ExecJS::RuntimeUnavailable:
[05:38:33] sevenseacat: so install a runtime.
[05:38:35] yza: gonna try rubyracer and excejs gem per this article i suppose
[05:39:37] sevenseacat: you only need one
[05:39:48] yza: suggestions?
[05:44:01] rvanlieshout: goot ug-something
[05:47:33] yza: morning
[05:48:37] tagrudev: a coffee and an apple it's a good morning yeah
[06:36:15] yza: progress but
[06:36:21] yza: not there yet :-/
[06:48:26] capin: anyone know if ":class => 'input-xlarge' " still works with the latest version of bootstrap?
[06:49:45] helpa: capin: Why don't you try it and find out for yourself?
[06:49:45] waseem_: capin: !try
[06:50:43] capin: i did, it's not working :/
[06:50:46] cjk101010: it doesn't. you have to use the grid system instead.
[06:51:14] cjk101010: you may have a look at the migration guide http://getbootstrap.com/migration/
[06:51:25] cjk101010: *may want to have
[06:51:47] sevenseacat: guess that answers the question about whether or not it works :P
[06:53:38] capin: cjk101010: thanks
[07:32:20] capin: the btn doesn't want to center on the page (-.-)
[07:37:42] yekta: Hello, can anyone point me to a blog or example app on how to get ajax updating on a nested form? I???m looking to non ajax update the parent form and then ajax update a second nested form. So I???ve got my Project whcih has tasks which has comments, I want the comments to be ajaxified. I???m using cocoon but that???s not really what it does out of the box, it seems like there should be a way to do this with Rails out o
[07:37:42] yekta: the box, but I???m feeling more and more like I may have to just hack it together with my own jquery ajax handlers. Is that right?
[07:38:04] sevenseacat: what exactly are you trying to do?
[07:38:10] sevenseacat: and 'ajaxified' isnt an answer
[07:39:58] yekta: I???m trying to build a larger form which can update multiple schedules (no ajax), vanilla PUT to a multiple update controller action. Within that form however each Task has many comments which I would like to be able to be saved, updated etc., without having to superform.submit.
[07:40:14] yekta: In other words, I would like to CRUD the coments on each task using AJAX.
[07:40:29] sevenseacat: if its all in one form, then you wont be able to use any of rails' inbuilt helpers
[07:40:52] sevenseacat: you cant just submit part of a form
[07:42:54] yekta: I suppose that makes perfect sense doesn???t it.
[08:27:08] puppeh: Anyone knows why when I do mail.deliver on an actionmailer generated email I get a both text/plain and text/html email?
[08:27:15] puppeh: but without having a .text template
[08:27:30] Radar: How do people who use Puma configure a server to run two Puma-backed apps? Does anyone have an example of that?
[08:28:19] puppeh: does ActionMailer automatically generates a text/plain email from a text/html email template?
[08:31:00] puppeh: nvm, it was the premailer gem... duh
[08:31:30] xsannyx: How can I get a large image from omniauth-google-oauth2? auth.extra.raw_info.picture returns a really small one
[08:38:05] xsannyx: Nevermind fixed it with auth.extra.raw_info.picture.sub("?sz=50", "?sz=150") I should check what is the image link first anyway...
[08:41:03] greengriminal: really liking some of the new features in rails 4.2
[08:45:52] sonOfRa: what could be reasons for assets not being present in production? Log says (No route matches [GET] "/assets/logo-083a8b489fabbcb081677cbaff80db37.png"):
[08:46:07] sonOfRa: all css and js files are gone, too
[08:47:41] sevenseacat: not enough info to say.
[08:47:49] rvanlieshout: because you've recompiled assets and did not restart you rails server?
[08:49:36] sonOfRa: stopped the rails server, deleted the compiled assets, recompiled again, same error
[08:50:15] sevenseacat: so you still didnt restart your rails server after compiling? >_>
[08:50:58] sonOfRa: uh, I stopped it before compiling and started it back up
[08:51:01] sonOfRa: now getting the same error.
[08:51:23] sonOfRa: I'm an idiot
[08:51:57] sonOfRa: disabled the rails asset server, but was deploying without passenger for testing something in production
[08:52:11] rvanlieshout: rails asset server?
[08:52:20] sonOfRa: config.server_static_assets
[08:52:32] sonOfRa: is disabled by default in environments/production.rb
[08:52:43] rvanlieshout: isn't that serve_static_assets
[08:52:51] sonOfRa: uh, yes. Typo
[08:52:52] rvanlieshout: which is disabled cause your web server should do that
[08:53:36] sonOfRa: yes, I realize why it's disabled, but I was deploying to production without a web server just to test whether anything breaks when I deploy to production
[08:54:27] sonOfRa: hence "I'm an idiot"
[08:55:17] iamvfl: good evening folks
[08:59:06] Meta5: Where you from?
[09:00:25] Radar: 13/f/nigeria, u?
[09:04:11] Meta5: definitely not evening in Nigeria
[09:04:21] Meta5: i???m in the United States
[09:04:29] Meta5: How did you end up in here Radar
[09:04:43] Radar: I am using proxy
[09:04:55] Radar: where am i
[09:05:00] helpa: http://i.imgur.com/tyViD.gif
[09:05:05] Radar: please give cc details
[09:06:33] Meta5: 1234 5678 9011 212
[09:06:38] Meta5: It???s an American Express
[09:06:44] Meta5: have fun!
[09:06:46] Radar: not valid plz give again
[09:11:58] styrmis: Hello all, has any been using GlobalID at all?
[09:13:20] puppeh: what is that?
[09:14:26] styrmis: A new library that will be released with Rails 4.2, generates global ids for objects so that you can pass objects around easily e.g. to job queues, or when you???re using polymorphic relations
[09:14:47] styrmis: puppeh: https://github.com/rails/globalid
[09:15:39] ptrrr: one thing I???m not getting, aren???t ids global?
[09:15:44] ptrrr: I mean, global to the database
[09:16:03] Radar: omg you people
[09:16:04] Radar: seriously
[09:16:13] Radar: cc details not that hard
[09:16:47] styrmis: An example of a global id: gid://app/Person/1
[09:16:51] Macaveli: Can I just move all these files to my vendor folder? These files are needed for google analytics API https://www.evernote.com/shard/s389/sh/b407b429-eb1d-4ddb-921b-30eac09f8f99/ab4d4f3c83c8695fc95c1064a3fadac7
[09:17:17] ptrrr: styrmis: why is that better than just sending the id and doing Person.find(id) in the worker?
[09:18:15] styrmis: ptrrr: well, if you???re using polymorphism you might not know exactly what model you???re dealing with
[09:18:41] ptrrr: in that case I???d just lookup type
[09:18:46] styrmis: i.e., that Person could be a Child, could be an Adult
[09:19:20] styrmis: You could do that if you had a reference to the object, but what if didn???t have one?
[09:19:54] styrmis: Tbh, globalid just looks like a more formal implementation of what I???ve seen kicking about various StackOverflow answers, where people are making strings like ???Person-5??? and then splitting it later
[09:20:23] ptrrr: ok, I???m probably not really understanding the issue to begin with
[09:20:49] ptrrr: but I think I???m getting it now
[09:21:04] styrmis: Did you check the github page? It has a bit of background (https://github.com/rails/globalid)
[09:22:02] ptrrr: yes, I haven???t used workers in the way that will benefit from this feature
[09:22:47] hsps_: Hey i am testing the rails 4.2 beta i started the server and visited /console its showing me the 500 page of production
[09:26:08] hsps_: I removed webconsole gem and it shows the proper routes not found exception page
[09:26:47] hsps_: i am testing it in ruby 1.9.3
[09:26:50] hsps_: is that the problem?
[09:29:22] Macaveli: Where do I include plain HTML into rails?
[09:31:04] drale2k: Is the diff between a scope and a class method on a Model just style?
[09:31:27] workmad3: drale2k: there's a slight difference in behaviour if you return 'nil' from a scope compared to a class method
[09:31:58] workmad3: drale2k: but other than that, yeah... class methods are even patched onto chained query calls to allow you to chain them
[09:32:15] drale2k: workmad3: aye thanks
[09:33:45] hiall: Any good write ups on 4.2?
[09:34:12] workmad3: hiall: there's the beta1 announcement: http://weblog.rubyonrails.org/2014/8/20/Rails-4-2-beta1/
[09:34:18] hsps_: It seems the "route not found" that is showing up as 500 page in 4.2. Is it expected result?
[09:34:50] hiall: workmad3: yes was hoping for something that goes more into the details of new features
[09:35:14] styrmis: hsps_: is this on a fresh app or did you update an existing app?
[09:35:24] workmad3: hiall: plenty of links from there to more details? :P
[09:35:26] hsps_: stymis: fresh app
[09:35:31] hiall: workmad3: ok thanks
[09:35:53] workmad3: hiall: sorry, but I really don't get what more you want other than someone to do your googling for you :P
[09:36:17] hsps_: styrmis: http://awesomescreenshot.com/0173ccns97 this is what i get when i visit /console or a route that doesn't exsit
[09:36:32] hiall: workmad3: nah just previously with 4.1 etc there was some nice write ups when it went to beta going through all the parts, have googled not found any yet though ;)
[09:36:37] workmad3: hiall: especially as we're talking about a beta release that's less than a day old ;)
[09:36:51] styrmis: hsps_: does the console show up in the routes list when you run `rake routes`?
[09:37:24] workmad3: hiall: I think some people got burned writing up stuff about 4.1 pre-beta too, with things being moved out after they'd written stuff up
[09:37:55] hiall: workmad3: ah ok
[09:38:02] hsps_: styrmis: the /console is no there when i write 'rake routes'
[09:38:08] workmad3: hiall: so give it a couple of days for people to absorb the beta1 announcement and figure stuff out :)
[09:38:10] hsps_: styrmis: the /console is not there when i write 'rake routes'
[09:39:33] workmad3: hiall: if it's of interest, my first impressions are along the lines of 'yay, their queue abstraction has finally landed! yay, acceptance that a browser-based console is useful! boo, responders becoming third party'
[09:39:57] hiall: workmad3: thanks very useful :)
[09:40:17] workmad3: and I can see the use of GlobalID in a general sense, but not sure that it's going to be much impact for most people
[09:42:11] hiall: Yea not sure how useful GlobalID will be for day to day functionality
[09:43:08] workmad3: unless you're going to write an API or worker that acts as a resolver for multiple apps/models then I'm not sure it gives much advantage over current mechanisms
[09:44:28] workmad3: with that said, I can see how it could be useful for e.g. a distributed queue system for jobs... you throw your stuff onto one queue without much thought, it includes the gid of the model and some task to carry out... that can then be sent to a dispatcher that can handle figuring out what to do with it
[09:45:11] hiall: Yea wonder how well this will play with all my sidekiq jobs :)
[09:45:24] hiall: seemingly the filters have just been renamed, interesting
[09:45:32] workmad3: with a suitable dead-letter queue for unintelligible messages, you could then introduce new tasks and types with very little downtime by simply updating the dispatcher, restarting that and requeuing the dead letter queue
[09:45:36] hiall: does make more sense to use action as thats what it is referring to
[09:46:29] workmad3: but people who want that will already be doing it by rolling their own gid-esque mechanisms... so meh, will see where it goes :)
[09:47:18] workmad3: oh, the filters have been renamed for a while
[09:47:29] workmad3: that's just marking the old versions as deprecated
[09:47:39] hiall: ahh ok was not aware
[09:48:07] workmad3: I think they introduced before_action et. al. in 4.0
[09:48:44] styrmis: I worked out my issue with globalid (https://github.com/rails/globalid/issues/23), found a workaround for now
[09:49:32] styrmis: globalid is a very minor addition to Rails IMO, it???s something people have rolled on their own many times so I???d say the benefit is just in having one way to do it
[09:50:10] styrmis: With ActiveJob we???ll be able to handle asynchronous work without considering which backend will schedule/execute it, and globalid helps with that standardisation
[09:50:50] sonOfRa: concerning the asset pipeline: Do I have to namespace my javascript code somehow? Different pages use different on_load functions once the page is loaded. How would I handle this when all my js files are bunched into one big file?
[09:51:04] styrmis: For me, I have a polymorphic association (Tasks can be assigned to different types of Client) and now in the dropdown instead of doing something ugly I can use the global id so that when I process the form, I know what kind of entity I???m dealing with
[09:51:17] sonOfRa: I know I can remove require_tree and just do per-view javascript, but less http requests and more caching seem like a good idea
[09:51:30] workmad3: sonOfRa: yes, you need to adjust your JS so it only runs if appropriate
[09:51:31] styrmis: sonOfRa: several ways to do this, but I???ve been using pluggable_js
[09:52:17] workmad3: sonOfRa: I tend to personally do that by looking for specific components on a page rather than looking for a specific page... makes it much easier to move stuff around and restructure my views if the JS is not going "I'll only activate on page X"
[09:52:19] sonOfRa: will variables collide in different files, or is something in the asset pipeline smart enough to rename them before creating the big file?
[09:52:43] workmad3: sonOfRa: are you using coffeescript or raw javascript?
[09:52:56] sonOfRa: raw javascript, but I guess I can migrate to coffeescript if necessary
[09:53:12] sonOfRa: there's not a lot of javascript in this application, but this knowledge might be useful for future applications
[09:53:26] workmad3: sonOfRa: ok... then names you use in a file without a 'var' at the top-level will be on the window object and can step on each other's toes
[09:53:59] workmad3: sonOfRa: or rather, any name at the top-level will collide after concating the files together
[09:54:46] remink: Hey guys, I got a small issue with Devise and StrongParameters. Yes, standard issue for beginners :). Here is my gist : https://gist.github.com/remink/fb20193a6e422d6df95e. When I got to /users/1 I got my edit page, and then, when I save it displays "successful", but no change in my DB. I'm focusing on "city" attributes actually.
[09:54:47] workmad3: sonOfRa: the reason I asked about coffeescript is because the CS compiler wraps each file in (function {...}).call(this); to provide a local scope for each file after concat
[09:55:19] denym_: hey there, I have a symbol array with associations from an object. I want to iterate over them and call a method on each association, what obviously doesnt work since its an symbol... is there a method to make this symbol to a relation?
[09:55:19] sonOfRa: heh, that's what I was going to do if I'm not going to switch to CS
[09:55:37] workmad3: sonOfRa: the asset pipeline concat is pretty simple though... it purely concats the files together, no knowledge of the internals :)
[09:57:57] sonOfRa: is cs a true superset of js? i.e. can I just rename my files to .js.coffee for now?
[09:58:24] workmad3: valid JS != valid CS
[09:58:39] sonOfRa: okay, then the cs transition will have to wait, and I'll wrap it in a function block. Thank you
[09:58:42] workmad3: kinda like valid C != valid x86 assembler ;)
[09:59:42] workmad3: although CS -> JS is a bit closer than C -> x86asm... it feels very similar in most cases, just differences in syntax
[10:08:28] bMalum: Good Morning :) I have a new Project on Univeristy - Managing and also visualize the Status of Server and PCs - i want to code this in Ruby - so would it better to setup on every machine a RubyOnRails (so you can access on every machine to the Webinterface) or only Deamons which are connected to one server via an API?
[10:13:10] sergey_makagon: i like the idea with Deamons + API
[10:13:33] sergey_makagon: it's overkill to set up Rails on each machine
[10:14:03] joshua__: Hey guys, I've added `config.eager_load_paths += %W[#{config.root}/lib]` to my config/application.rb and now my app won't load: https://gist.github.com/joshmyers/f469cb381cea1bc5c049
[10:14:20] joshua__: undefined method `aliases' for Rails::Generators:Modul o_0
[10:14:43] bMalum: member:sergey_makagon - yeah so every machine is connected to the Internet or Network so it would be the best Idea ;)
[10:16:05] sergey_makagon: bMalum, yep, daemon + api calls on all computers + 1 server with Rails to show summary on some kind of dashboard.
[10:17:13] workmad3: bMalum: do you have to code that sort of agent up yourself, or would it be acceptable to use, say, nagios or newrelic server monitoring or any of the other dozens of decent, well supported and understood monitoring tools?
[10:18:30] bMalum: i think i have to code a Plugin for Nagios or sth like that because i want also to monitor a ZFS Pool and S.M.A.R.T Values of HDD and other ???unusual??? stuff ...
[10:18:47] workmad3: well, SMART monitoring isn't particularly unusual
[10:18:59] workmad3: ZFS monitoring also probably has a nagios agent plugin out there already
[10:19:10] bMalum: yep but is really crap :/
[10:19:20] workmad3: so write a better nagios plugin? :)
[10:20:08] joshua__: Anyone any ideas about my question? :(
[10:20:53] bMalum: wordmad3 - maybe but i think i will be faster with setting up a Sinatra API and a Deamon :D
[10:21:34] workmad3: bMalum: so you think writing the entire framework + agents and designing the secure communication protocol will be faster than improving one plugin with all of that already written? :/
[10:21:39] sergey_makagon: joshue__ looks like you need this code instead: %W(#{config.root}/lib)
[10:21:49] workmad3: sergey_makagon: that's exactly the same
[10:21:58] sergey_makagon: it's %W() ... you have %W[ ... ]
[10:22:02] workmad3: sergey_makagon: %W allows free use of delimiting tokens
[10:22:28] workmad3: sergey_makagon: %W() == %W[] == %W|| == %W{} == ...
[10:22:32] joshua__: indeed, thats the same and is still failing..
[10:22:43] iamvfl: so, I got a question
[10:23:11] workmad3: joshua__: that said, why not just 'config.eager_load_paths << config.root + "lib"' ?
[10:23:16] emka: If you were going to create assocication between classes, students and teachers where each student has ONE class, and each teacher can have many classes and each class can have many teachers? Something like this ? https://gist.github.com/emilkarl/af6e0a82a95bde20aa82
[10:23:30] workmad3: joshua__: not that I think it'll change much... I suspect it's some code in your lib/ that doesn't like being eager-loaded
[10:23:39] joshua__: workmad3: because some paths are already eagerly loaded, I want to append these, not blat them with my one path.
[10:23:57] workmad3: joshua__: read my suggestion again
[10:24:02] workmad3: joshua__: it doesn't change the existing paths
[10:24:07] joshua__: ah yeah sorry
[10:24:16] iamvfl: I have a method that I share across a few controllers (lightbox_layout), like this: https://github.com/iamvfl/portfolio/blob/master/app/controllers/article_categories_controller.rb and https://github.com/iamvfl/portfolio/blob/master/app/controllers/pages_controller.rb
[10:25:12] workmad3: joshua__: eager-loading lib, like auto-loading lib, is somewhat ill advised though, especially as you have no control over the order code in there will be loaded
[10:25:14] iamvfl: I???m wondering, for something like that, should I make some sort of generic controller to inherit from to abstract some of that functionality or would there be another place that???s better suited for those types of functions (e.g. helpers)
[10:25:46] joshua__: I need to fir sidekiq workmad3 :/
[10:26:01] workmad3: joshua__: you can't require the stuff you need in your sidekiq job? :P
[10:26:16] joshua__: https://github.com/mperham/sidekiq/wiki/FAQ#why-doesnt-sidekiq-autoload-my-rails-application-code
[10:26:31] joshua__: I could but this seemed like suggested fix.
[10:27:03] workmad3: joshua__: I'd suggest having a file 'lib/workers.rb' that you can require, and that file explicitly loads the workers and any required code
[10:27:31] Sylario: I'm trying to understand closures : http://stackoverflow.com/questions/25402377/trying-to-understand-closure-with-a-sum-of-functions-applied-to-object
[10:27:33] workmad3: joshua__: then you can simply do 'require "workers" ' either in an initializer, or in an AR model that needs the workers
[10:27:52] workmad3: joshua__: you can also use the same file in your sidekiq runner setup to load just your workers without loading the entire rails stack
[10:29:23] joshua__: ok thanks workmad3
[10:30:16] workmad3: joshua__: eager-loading everything under lib/ is somewhat drastic as not everything in there will be related to sidekiq workers, along with previous issues with ordering the loads, etc... it's a bit more book-keeping to manage a file like workers.rb yourself, but you keep control over ordering and don't end up with weirdnesses where you break generators because you just loaded custom generator code (which is also u
[10:30:36] joshua__: indeed, thx
[10:30:47] Sylario: If someone understand closure i have a question about refactoring simple code using closure instead of copypasta : http://stackoverflow.com/questions/25402377/trying-to-understand-closure-with-a-sum-of-functions-applied-to-object
[10:32:40] workmad3: Sylario: well, both your .each blocks are already using closures
[10:32:46] workmad3: Sylario: so I'm not sure what your question really is
[10:33:08] Sylario: workmad3: each ar closures?
[10:33:17] workmad3: Sylario: the block you pass to each is a closure
[10:33:27] workmad3: Sylario: as it closes over the local variables from outside the block
[10:33:59] workmad3: Sylario: it sounds more like you want to generalise to having a single method you can customise with a block yourself instead though...
[10:35:02] iamvfl: Can anyone give any advice on my previous question? (in case it got lost in all the commotion)
[10:36:21] workmad3: Sylario: e.g. something like https://gist.github.com/workmad3/cff14a5af16d84bb9d69
[10:36:56] Sylario: workmad3: but, each it's just a loop with it's own scope
[10:37:23] workmad3: Sylario: you're accessing 'total' in the each block from outside the block
[10:37:26] workmad3: Sylario: that's what a closure does
[10:38:13] workmad3: Sylario: it's the *block* that's the closure btw, not the each method
[10:39:35] Sylario: i'm trying to understand
[10:40:12] Sylario: How is it defferent from a loop in Java (from what i read, java does not have closure)
[10:40:37] ibotexo: hi all. i have to add an argument (:rev_to) to a method if my variable is not null. is there a special syntax for passing it? https://github.com/redmine/redmine/blob/master/app/helpers/application_helper.rb#L778
[10:40:54] ibotexo: the argument is optional
[10:41:45] ibotexo: can i use unless x.nil?, what about brackets?
[10:41:46] workmad3: Sylario: because .each isn't a simple for loop that's executing in the local scope
[10:42:23] workmad3: Sylario: .each is a method call on a collection that takes in an anonymous function and evaluates that anonymous function for each item within the collection
[10:43:21] workmad3: Sylario: the block is a closure over the context/scope it was created in, so has access to the local variables within that scope and can read/modify them
[10:43:26] Sylario: like in javascript, where you see it because anonymous function are still declmared?
[10:44:14] workmad3: Sylario: yeah... in JS all your functions are also closures... they may have their own inner scope, but they still have access to the outer scope
[10:44:57] workmad3: Sylario: in ruby, 'def', 'class' and 'module' act as barriers that create a new scope without access... but blocks have access to the external scope they were created in
[10:45:21] Sylario: ok, thanks workmad3
[10:45:35] walidvb: is it not possible in rspec to force an object to return a certain value on a query?
[10:45:36] workmad3: Sylario: and it's that keeping track of the outside context that makes them a closure
[10:46:15] walidvb: some kind of let @book.respond_to?(:preview?).and_return true ?
[10:47:21] workmad3: walidvb: it is... but you need to be careful when doing that sort of thing that 1) you are actually setting up the stub methods on the right thing (e.g. in a controller, new objects are loaded that won't have the stubs you set up on objects in the test) and 2) that you don't over-do that and create tests that don't actually correspond to actual code
[10:47:59] walidvb: workmad3: 2) ok
[10:48:28] walidvb: 1) i can stub those mehtods on objects loaded within my controller_spec? how?
[10:48:57] walidvb: @book3.stub(:preview?) => false
[10:49:31] workmad3: walidvb: two ways... you can either use Book.any_instance.stub, or you can stub out the query on Book to return your @book3 object
[10:49:55] workmad3: walidvb: I'd generally suggest using Book.any_instance.stub nowadays, as that's much less intrusive into your controller implementation
[10:50:11] walidvb: workmad3: i need to stub only this 1 book
[10:50:29] workmad3: walidvb: no... you need to stub the new book instance created by doing a query in the controller
[10:51:11] walidvb: hm. the books are created in my controller_spec. but i get that i need to stub only this one instance
[10:52:22] workmad3: walidvb: stop thinking that the instance you created in the spec == the instance that you use in the controller action
[10:52:27] workmad3: walidvb: that is a wrong assumption
[10:52:50] workmad3: walidvb: in the controller spec you simply used the instance as a way to get data into the database
[10:53:24] workmad3: walidvb: that instance is completely invisible to the controller... in the controller, you create a new instance with data loaded from the database
[10:53:27] walidvb: workmad3: not sure i understand what you mean. You're saying that the object instantiated in the spec is saved to DB, and that of the controller is loaded from DB, so the instance is not the same?
[10:53:34] workmad3: walidvb: exactly
[10:54:11] workmad3: walidvb: ideally, the data you write to the db will be such that 'preview?' will already be false for it
[10:54:13] walidvb: exactly. that's ot a problem, because i don't want to stub a call from the controller, but from a call that happens in my spec, on that object
[10:54:44] workmad3: walidvb: I thought this was a controller spec :/
[10:55:06] workmad3: walidvb: and if so... why do you care about a stub method on a model within it? :/
[10:55:08] walidvb: i call @user.subscribe_to(@book3), and in that method, i'd like @book3 (the arg of subscribe_to) to return false to proview?
[10:55:35] workmad3: walidvb: why not just generate book3 so that preview? is false?
[10:56:33] walidvb: cause i compare serialized values of books, and the date formats are different in my test and in my controller, making the tests fail. So i set the dates to nil as a workaround
[10:56:49] walidvb: but preview needs a date to return false....
[10:57:19] walidvb: you're gonna tell me i shouldfix this date format, instead...
[10:57:23] workmad3: pretty much :P
[10:57:29] walidvb: fo shizzle
[10:57:37] workmad3: I mean, you could stub out preview? on @book3 before passing it into the subscribe method
[10:57:54] walidvb: @book3.stub(:preview?).and_return(false)
[10:57:55] workmad3: but that would just be hiding the problem
[10:58:11] workmad3: and tests aren't meant to hide problems
[10:58:16] walidvb: then again, problem is not important in that test hehe
[10:58:16] workmad3: tests are meant to expose problems
[10:58:29] workmad3: is it a problem you're going to fix?
[10:58:30] walidvb: workmad3: arf. i should've kept my mouth shut ;)
[10:58:40] iamvfl: anybody feel like helping me out with an opinion?
[10:58:45] walidvb: because it' sjust date formatting, that i don't care about at all
[10:59:07] workmad3: walidvb: you don't even care why you've somehow got two inconsistent date formats in your codebase?
[10:59:17] walidvb: i don't care if my test and my controller decide to return differnet formats
[10:59:28] walidvb: workmad3: i do, but not a prority :/
[10:59:37] iamvfl: I have a function that checks for a url parameter and changes the layout depending on that. That functionality is shared across many controllers. Should I make that method a part of a base controller class to inherit from or is a better place for this kind of thing in a helper class?
[11:00:07] walidvb: iamvfl: why not as a filter?
[11:00:19] workmad3: walidvb: well, do what you think is most useful for now, obviously
[11:00:28] walidvb: implemeented in ApplicationController, called in your other controllers?
[11:00:35] workmad3: walidvb: but I'd personally be worried about papering over a crack with a hack like that in a test
[11:00:41] walidvb: workmad3: i'll add a #TODO, for sure
[11:00:50] walidvb: and raise the issue to my colleagues
[11:01:02] walidvb: still, that stubbing isn't working
[11:01:04] iamvfl: walidvb: it is a filter, but I can???t share that across multiple controllers, can I?
[11:01:20] workmad3: walidvb: could be the issue isn't what you think then ;)
[11:01:42] walidvb: iamvfl: if they inherit from Application Controller, they can, yes
[11:02:07] walidvb: workmad3: lol. it really is the stubbing that doesn't work, somehow it calls preview? with an argument
[11:02:51] workmad3: walidvb: rspec 2 or rspec 3?
[11:03:05] iamvfl: walidvb: thanks, that???s exactly what I needed
[11:03:29] walidvb: iamvfl: afaik that's how filters were designed? no expert at all here, though
[11:04:06] workmad3: walidvb: well .stub(:preview?).and_return(false) should be fine... used it plenty of times
[11:04:17] workmad3: walidvb: you could try .stub(:preview?) {false}
[11:04:43] walidvb: yeah was about to try those: https://relishapp.com/rspec/rspec-mocks/v/2-14/docs/method-stubs
[11:04:48] workmad3: walidvb: beyond that, would need to see the test
[11:04:54] georgesmith: Hello all, writing an API in rails. What do you think the best date format to use would be? Unix time?
[11:05:03] workmad3: georgesmith: iso8601
[11:05:10] walidvb: https://gist.github.com/anonymous/26d82db65d65b8cc8a96
[11:05:36] georgesmith: wordmad3: thanks, i???ll take a look at that
[11:05:50] workmad3: georgesmith: i.e. the international standard for representing dates and times
[11:07:01] workmad3: it's not perfect, but it's better than unix time for transferring dates ;)
[11:07:49] walidvb: workmad3: hm. never mind, enough time on this, i'll go another ugly way. just set @book3.date back to nil
[11:07:56] workmad3: walidvb: heh
[11:08:00] workmad3: walidvb: still didn't work?
[11:08:04] mozzarella: how can you return content to the user but still execute some stuff? stuff that should not delay the request
[11:08:10] walidvb: workmad3: thanks for the talk, though. and i'll keep in mind that controller vs test object issue
[11:08:19] walidvb: mozzarella: delayed_jobs
[11:08:26] workmad3: mozzarella: background tasks, delayed jobs, worker queues
[11:10:16] hadifarnoud: I followed this guide for setting up my server: https://gorails.com/deploy/ubuntu/14.04 now I can't run any rake task by 'root' or 'deploy' user via ssh. it says
[11:10:19] hadifarnoud: ActiveRecord::NoDatabaseError: FATAL: role "deploy" does not
[11:10:19] ibotexo: sorry for repeating my question: i have to add an argument (:rev_to) to a method if my variable is not null. is there a special syntax for passing it? https://github.com/redmine/redmine/blob/master/app/helpers/application_helper.rb#L778
[11:10:19] hadifarnoud: Run `$ bin/rake db:create db:migrate` to create your database
[11:10:37] workmad3: mozzarella: if you feel up to it, you could try out ActiveJob ;)
[11:10:39] hadifarnoud: despite having my db setup already
[11:13:18] workmad3: hadifarnoud: that error is about a user not existing, which implies that you don't have an explicit user set in your database.yml
[11:13:57] hadifarnoud: workmad3: I do have the username setup there.
[11:14:35] workmad3: hadifarnoud: oh... you'll also need to specify the rails env
[11:14:45] workmad3: hadifarnoud: RAILS_ENV=production
[11:14:55] workmad3: hadifarnoud: prefix your commands with that
[11:15:09] hadifarnoud: workmad3: oh, I have to do it every time?
[11:15:16] hadifarnoud: did not know that
[11:15:31] workmad3: either that or export it from your .bashrc or .zshrc so it's permanently set for your user
[11:15:48] workmad3: or use capistrano to run commands remotely rather than logging in to the server
[11:15:57] hadifarnoud: so I add export RAILS_ENV=production to the end of my bashrc? workmad3
[11:18:06] hadifarnoud: nevermind. works fine :)
[11:48:31] Macaveli: Hi all ! :)
[12:20:29] lolmaus: Hi. I'm a frontend dev. I've got a form that has a bunch of checkboxes sharing the same name attribute. I would like to replace them with a custom input that passes data to rails via a hidden input. I struggle to figure out how to mimic those checkboxes with a single hidden input.
[12:21:08] lolmaus: I tried `<input type="hidden" value="[0,2,4]">` where numbers are checkbox values, but it won't work.
[12:31:28] stan_br: I'm trying to make a rails 4 application that is as fallow: a recipe has_many tags. Many tags are _already_ in the database on its own table. When the user creates a new Recipe, it should be able to select many tags. I was trying to do that with nested attributes, but since I'm not creating new Tags, I guess thats not the right way to do it. Any tips?
[12:42:30] greengriminal: Anyone whose had experience with liquid could you please shed a little light on the following: https://gist.github.com/anonymous/ea40f225f9840e0365b2
[12:42:47] greengriminal: I don't see what the difference is between the two apart from they use different models.
[12:56:12] Moonlight-Angel: Hello ! Got a little problem with Devise, account creation suddenly stopped working. When I try to create an account with an unused email, the console says User Exists, then Rollback immediatly. Any suggestions ?
[12:57:15] rolfb: Moonlight-Angel: did you verifiy noone else registered said user? is there something else in the model that has uniqueness?
[12:58:55] Moonlight-Angel: rolfb > It's still in development so I'm the only user registered :). I thought it was FriendlyId which may block registrations so I tried disabling it but still no luck.
[12:59:13] Moonlight-Angel: The users table is untouched. I have a profiles table that are associated to one user.
[13:00:56] rolfb: Moonlight-Angel: no other messages than User exists?
[13:01:08] Moonlight-Angel: Not in the console.
[13:01:55] rolfb: Moonlight-Angel; try inspecting the errors method on the user object after you've tried to save it
[13:02:17] Moonlight-Angel: Okay, I commented out all the associations with the profiles table and it works. It must be a problem inside the profiles table.
[13:10:58] Moonlight-Angel: rolfb > Got it. User has one profile and profile has one privacy_settings. The privacy settings were not passed and the validation contains validates_presence_of :D
[13:14:32] jsrn: Is there jazzy railsy way to handle the situation where you want to perform the same action on multiple objects in one post/patch? e.g. POST /users/1,2,3 instead of POST /users/1, POST /users/2, POST /users/3 ? Would you just parse params[:id] in the controller, or is there a better way I'm missing?
[13:19:52] sonOfRa: I'm writing an LDAP management tool, and I'm having some trouble testing it. I can't just deploy an ldap server on every test machine. I have written a small layer that interfaces between my library and Net::LDAP. Would it be reasonable to re-implement that layer with an sqlite backend, and use that for testing instead?
[13:20:21] sonOfRa: I don't plan on testing the interface itself, or Net::LDAP, I'm assuming they both work
[13:24:17] mikecmpbll: anyone know how i can stop paperclip trying to file-stuff when i save/edit a model which has has_attached_file ?
[13:24:26] mikecmpbll: trying to do some data migration and i don't care if the file exists or not right now.
[13:26:39] mikecmpbll: ah nvm, got it
[13:26:47] mikecmpbll: it was my own callback to encrypt the file that was causing it anyway, ha.
[13:31:38] _lazarevsky: I would like to check if the request coming in is for /ping or /sping and return 200 if that's the case
[13:31:43] _lazarevsky: how can I do that?
[13:32:19] momomomomo: _lazarevsky: http://guides.rubyonrails.org/routing.html
[13:32:25] _lazarevsky: thanks momomomomo
[13:33:00] _lazarevsky: momomomomo: the application controller gets called before the request is routed to the appropriate controller, no?
[13:33:19] _lazarevsky: I am in the context of ApplicationController
[13:33:31] _lazarevsky: I need to check which route is requested from the APplicationController
[13:34:10] momomomomo: _lazarevsky: http://ruby.learncodethehardway.org/book/ex44.html
[13:34:32] momomomomo: also, I???d recommend learning how rails routing works by reading my initial link.
[13:34:56] _lazarevsky: momomomomo: I would definitely do that. I definitely need to ramp up my rails skills
[13:35:11] _lazarevsky: momomomomo: but I just had a eureka moment. I've been stuck on a problem for 3 days and could not explain it
[13:35:15] helpa: _lazarevsky: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[13:35:15] workmad3: _lazarevsky: !code for what you have current please
[13:35:32] _lazarevsky: workmad3: HEY!!!
[13:35:43] _lazarevsky: workmad3: no sample code. I can provide you with pseudo-code
[13:35:49] workmad3: ACTION wonders why he's being shouted at
[13:35:51] momomomomo: don???t spoonfeed
[13:36:11] momomomomo: _lazarevsky: basically, your three days may have been averted by understanding how rails routing works
[13:36:13] _lazarevsky: workmad3: I only want to find out which route is being requested and return 200
[13:36:21] momomomomo: so if you relax and actually read that routing link
[13:36:25] momomomomo: then you???ll learn how to do it
[13:36:33] momomomomo: that???s pretty much the gist of your situation
[13:36:33] _lazarevsky: momomomomo: no.. I was looking at the wrong places. I thought there was a problem with kerberos certificates
[13:36:43] _lazarevsky: momomomomo: then I checked our internal services and thought the proxies were wrong
[13:36:48] workmad3: _lazarevsky: right... then just read the routing guide
[13:36:51] momomomomo: then gist up your current code for your routes and controller
[13:37:03] _lazarevsky: the prbolem is
[13:37:07] momomomomo: but you don???t have any - so what have you tried?
[13:37:20] _lazarevsky: our load-balancer keeps pinging the hosts behind it to see if they're ok
[13:37:22] workmad3: _lazarevsky: and here's a hint... you shouldn't be doing this in your application controller, and by phrasing it as 'I want to find out what the route is' means you're coming at this from a very bad understanding ;)
[13:37:27] _lazarevsky: if thgey return anything other than 200 for a period of time
[13:37:38] _lazarevsky: it thinkgs they are not ok and stops routing requests to them
[13:37:48] momomomomo: _lazarevsky: that???s simple - just read the routing link
[13:37:51] _lazarevsky: in my last code change in the app controller in a method referenced in before_action I'm doing a check
[13:37:57] _lazarevsky: and returning 401 if a condition is not fullfiled
[13:38:04] momomomomo: basically you want a ROUTE ???/ping??? which returns 200, correct?
[13:38:07] _lazarevsky: however, i totally forgot that this health monitoring service will be pinging my app
[13:38:16] _lazarevsky: momomomomo: yes.. simple as that
[13:38:26] _lazarevsky: momomomomo: but I need to do that from the ApplicationController
[13:38:31] workmad3: _lazarevsky: no you don't
[13:38:31] momomomomo: it actually should probably return 204, and you should probably read http://guides.rubyonrails.org/routing.html
[13:38:38] momomomomo: why do you need to do it from the applicationcontroller _lazarevsky ?
[13:38:57] momomomomo: or why do you think you need to?
[13:38:58] _lazarevsky: momomomomo: that's where I'm doing the checks whether the user has a kerberos creds inserted in the requested
[13:39:15] _lazarevsky: workmad3: that's where I'm doing the checks whether the user has a kerberos creds inserted in the requested
[13:39:15] workmad3: _lazarevsky: !g skip_before_action
[13:39:30] workmad3: momomomomo: ^^ is that too much spoon feeding? :)
[13:39:30] momomomomo: thank you workmad3
[13:39:45] momomomomo: no that???s gooooood
[13:39:58] _lazarevsky: hah bastards.. killing the buzz from my eureka moments :)
[13:40:16] momomomomo: eureka moments that are incorrect aren???t eureka moments
[13:40:21] momomomomo: eureka moments canb e had by reading the documentation
[13:40:23] workmad3: _lazarevsky: nah, the 'eureka' moment would be figuring out how to do it directly in routes.rb :P
[13:40:27] mikecmpbll: stop programming in the bath.
[13:40:43] _lazarevsky: mikecmpbll: haha! good one
[13:40:57] mikecmpbll: :D i should try that actually.
[13:40:58] momomomomo: tagrudev: archimedes
[13:41:18] tagrudev: a pool full with beer
[13:41:19] workmad3: ACTION wishes he had a chunk of gold in the bath with him...
[13:41:30] momomomomo: ACTION wishes he had a chunk of gold
[13:41:44] tagrudev: ACTION chunk's gold
[13:43:48] _lazarevsky: workmad3: do it from routes.rb? to: expects a controller name and a method :/
[13:44:07] workmad3: _lazarevsky: when you figure it out, you'll understand routes a lot better ;)
[13:44:20] mikecmpbll: ya it's not sinatra.
[13:46:46] _lazarevsky: request.fullpath :P
[13:46:52] _lazarevsky: that didn't hurt at all :)
[13:46:53] workmad3: _lazarevsky: don't do it that way
[13:46:55] _lazarevsky: thanks guys :)
[13:46:57] workmad3: _lazarevsky: seriously
[13:47:00] workmad3: _lazarevsky: you're doing it wrong
[13:47:14] _lazarevsky: um.. that's exactly what I'm trying to achieve though
[13:47:31] _lazarevsky: workmad3: I seriously need to check whether this would solve the problem
[13:47:41] workmad3: _lazarevsky: no... you're trying to get a route that responds with 200 or 204 that doesn't do your kerberos checks
[13:47:50] _lazarevsky: workmad3: dont wanna sound like a cowboy programmer.. but after three days of doing ops stuff I need to check whether this solve the problem
[13:47:59] _lazarevsky: workmad3: exactly
[13:48:15] workmad3: _lazarevsky: right... and I just gave you a google hint to a method that *skips* before filters
[13:48:31] _lazarevsky: workmad3: I must have missed it
[13:48:32] workmad3: _lazarevsky: and that doesn't require you to hard-code in specific hacks around route paths
[13:48:37] _lazarevsky: let me check the logs
[13:48:53] Moonlight-Angel: Hey again, say I have User has one Profile and Profile has one PrivacySettings. How can I create privacy_settings on account registration ? Nested attributes for Profile are in the registration form and thus added to the db, but I have no attributes for PrivacySettings in the form. How can I create them in db on Profile creation ?
[13:50:27] mikecmpbll: Moonlight-Angel: after_save callback on Profile?
[13:50:35] mikecmpbll: after_create*
[13:50:52] _lazarevsky: workmad3: ok so in the skip_before_action i'll define a method which is called before the other actions, but I'll still need to retrieve the path requested from the request object..
[13:51:06] workmad3: _lazarevsky: no... no no no
[13:51:23] Moonlight-Angel: mikecmpbll > Is it save if I do it that way ? I'll have to perform validates_presence_of :privacy_settings on update only then.
[13:51:46] mikecmpbll: before_create then, if you're validating.
[13:51:59] webus: does anybody jump from django to rails and happy ?
[13:52:07] workmad3: _lazarevsky: what you want is a *normal* controller action that just doesn't do the kerberos checks, which I'm guessing are a before_filter in your application controller
[13:52:12] doubleemms_: webus: i did.
[13:52:43] _lazarevsky: workmad3: correct.. but I ONLY want to return 200 if the requested paths are /sping or /ping
[13:52:48] Moonlight-Angel: mikecmpbll > before_create is called after validation, isn't it ?
[13:52:52] _lazarevsky: because those routes are hit by the health monitoring service periodically
[13:52:54] webus: doubleemms_, why you do it ? i work on django but sometimes look at rails. and can't deside, can i jump or not
[13:53:03] workmad3: _lazarevsky: right, which is your controller action
[13:53:16] workmad3: _lazarevsky: and the action that you skip your checks on
[13:53:45] _lazarevsky: workmad3: you lost me mate
[13:53:54] _lazarevsky: workmad3: just to reiterate, im in the context of an ApplicationController
[13:53:59] workmad3: _lazarevsky: no, you're not
[13:54:06] workmad3: _lazarevsky: you're always in the context of a subclass of that
[13:54:10] _lazarevsky: im not in the PingController
[13:54:15] _lazarevsky: I see what you mean
[13:54:15] workmad3: _lazarevsky: yes you are :P
[13:54:24] mikecmpbll: Moonlight-Angel: woops, yep your right. before_validation :create_privacy_settings, if: proc { |obj| obj.new_record? }
[13:54:27] mikecmpbll: something like that
[13:54:36] _lazarevsky: workmad3: :P I see :D
[13:54:41] workmad3: _lazarevsky: lightbulb finally? :)
[13:54:55] mikecmpbll: Moonlight-Angel: or just put the check in your create_privacy_settings method
[13:55:04] doubleemms_: sokath, his eyes uncovered!
[13:55:19] workmad3: _lazarevsky: praise cthulhu!
[13:55:21] _lazarevsky: skip_before_action is defined in the PingController
[13:55:26] _lazarevsky: halleluyah brothers!
[13:55:27] _lazarevsky: praise the lord
[13:56:20] workmad3: ACTION wants a chibithulu emoji
[13:57:52] neredsenvy: My situation: I have ruby/gem/git/rails installed on my VPS (Ubuntu 12LTE) running with no problems. I use Sublime+SFTP plugin to download my source code to my local pc and any edits/saves are synced to the vps. The problem I have now is when I open putty and call rails s to run the server I can't do anything else like call generate commands...
[13:57:56] _lazarevsky: workmad3: there are two requests coming in.. one for HTTP and the other one for HTTPS.
[13:58:01] _lazarevsky: ping and sping respectively
[13:58:10] workmad3: _lazarevsky: route them both to the same controller action
[13:58:19] workmad3: _lazarevsky: your rails app doesn't give a crap about them :P
[13:58:23] neredsenvy: I'm brand new to Ruby did some testing around few months ago but I'm now setting up to work on a personal/bigger project
[13:58:35] _lazarevsky: workmad3: I love how your brains works
[13:58:44] _lazarevsky: workmad3: I'd love to crack open your skull and kiss it
[13:58:51] workmad3: ACTION backs away slowly
[13:59:03] _lazarevsky: no no.. come here.. I just wanna kiss it
[13:59:16] _lazarevsky: ACTION starts pacing up towards workmad3 
[13:59:18] workmad3: my wife kinda likes me with the top of my skull attached
[13:59:22] sysx1000: Sorry, probably wrong channel, but this Sass::SyntaxError in Locomotive/pages#index drilled myself completely. I am trying to give a chance for Locomotive CMS
[13:59:24] mikecmpbll: neredsenvy: if the vps is for production you'll want to set up a production application server
[13:59:37] mikecmpbll: which'll also handle booting your app up in the background
[13:59:44] workmad3: sysx1000: sounds like one of your sass stylesheets has a syntax error
[13:59:54] Moonlight-Angel: mikecmpbll > Got it working. Thanks :)
[13:59:58] doubleemms_: webus: it was really more of a team decision, but i like the convention driven nature of rails. once you get a feel for rails' conventions, there's a whole class of trivial decisions you don't really have to think about on a daily basis. it can really free you to think about your problem instead of being mired in technical decisions.
[14:00:06] neredsenvy: mikecmpbll: I'm not at that point yet at the moment I'll be just writing code and testing
[14:00:14] neredsenvy: Now that I think of it
[14:00:20] mikecmpbll: neredsenvy: just test locally then
[14:00:27] neredsenvy: If I run generate command I have to reboot the server right ?
[14:00:35] mikecmpbll: yep probably.
[14:00:35] neredsenvy: for the change to take effect
[14:00:36] sysx1000: it???s not mine, it???s shipped with Locomotive. Not sure that any errors there, probably something wrong with their engine installation process
[14:00:37] workmad3: neredsenvy: depends on what you generate
[14:00:45] neredsenvy: controller/model/view
[14:00:59] workmad3: neredsenvy: controllers, models and views don't need server restarts generally
[14:01:02] webus: doubleemms_, thanks. i try rails on this weekend
[14:01:33] puppeh: I've added a Rails.logger.warn line to time the seconds passed between a code executing
[14:01:51] puppeh: and I got a result like this: 2.3837e-05
[14:01:53] neredsenvy: Hm guess I could create a second account on the VPS and run the server on one and use generate tool on the other
[14:02:10] workmad3: puppeh: sounds about right... just under a millisecond
[14:02:38] workmad3: puppeh: or do you need a 'how to read scientific notation 101' class? :)
[14:03:07] workmad3: puppeh: that representation == 2.3837 * 10^-5
[14:03:19] puppeh: aha I get it
[14:03:55] workmad3: mikecmpbll: yeah, I managed to do e-4 in my head :)
[14:04:44] workmad3: ACTION looks up what his next work task is to get away from a conversation where he made a mistake
[14:06:44] mikecmpbll: i just had to wait 10 mins for a transaction to rollback
[14:06:48] mikecmpbll: was a big ol' transaction
[14:07:05] momomomomo: that is unacceptable
[14:07:09] workmad3: mikecmpbll: mysql?
[14:07:20] workmad3: mysql sucks
[14:07:26] momomomomo: why not switch to mariadb
[14:07:35] mikecmpbll: because i'm not cool enough :(
[14:07:41] momomomomo: it???s a drop-in replacement for mysql
[14:07:43] workmad3: momomomomo: wouldn't make much improvement :P transactions would still be implemented around locks
[14:08:24] momomomomo: workmad3: https://blog.mariadb.org/significant-performance-boost-with-new-mariadb-page-compression-on-fusionio/
[14:08:30] mikecmpbll: "Beware of big rollbacks of mass inserts: InnoDB uses the insert buffer to save disk I/O in inserts, but no such mechanism is used in a corresponding rollback. A disk-bound rollback can take 30 times as long to perform as the corresponding insert. Killing the database process does not help because the rollback starts again on server startup. The only way to get rid of a runaway rollback is to increase the buffer
[14:08:30] mikecmpbll: pool so that the rollback becomes CPU-bound and runs fast, or to use a special procedure."
[14:09:20] mikecmpbll: momomomomo: yeah i was looking at mariadb a while ago. does it work with the mysql2 adapter?
[14:10:01] momomomomo: I haven???t looked at it much
[14:10:32] momomomomo: ok, time to get back to work
[14:11:42] sonOfRa: mikecmpbll: considering mariadb is a drop-in replacement for mysql, I don't see a reason for it not to work
[14:11:42] workmad3: momomomomo: I'd be interested to know how much of http://grimoire.ca/mysql/choose-something-else still applies to maria personally (my guess is 'most, if not all, of it')
[14:12:22] mikecmpbll: i've never had any specific problems with mysql (although it could be a case of you don't know what you're missing)
[14:12:34] mikecmpbll: and i've had all kinds of issues trying to write postgres queries for people in here
[14:12:41] sonOfRa: Though none of these apps were rails apps, I migrated a lot of different apps (java, php) from mysql directly to mariadb without any problems
[14:13:00] momomomomo: workmad3: I???ve read that and anyone considering it should check out https://mariadb.com/kb/en/mariadb/mariadb-vs-mysql-features/
[14:14:07] momomomomo: and also https://mariadb.com/kb/en/mariadb/mariadb-vs-mysql-compatibility/
[14:14:24] sysx1000: mikecmpbll: it is why we switched to Postgres once
[14:14:54] momomomomo: can???t always ???just switch to postgres??? :p
[14:15:14] mikecmpbll: i have trouble with postgres not allowing me to group without an aggregate function
[14:15:20] momomomomo: mikecmpbll: being unable to write postgresql queries is just a lack of knowledge about them
[14:15:40] workmad3: momomomomo: that doesn't really solve the big design problem of pluggable storage engines causing massive issues with query optimisation
[14:15:51] momomomomo: workmad3: never said it did
[14:16:06] momomomomo: you???d do better to ask someone who actually knows anything about mariadb
[14:16:21] mikecmpbll: momomomomo: not really, i know how to write them, but i don't like it so much :)
[14:16:38] workmad3: momomomomo: well you pointed to a list of maria vs mysql features, one of the 'main' ones on that page seems to be 'look at us, we have more table engines to choose from!'
[14:17:24] sysx1000: i am afraid of ???switching engines???
[14:19:37] workmad3: mikecmpbll: http://grimoire.ca/mysql/choose-something-else#bad-arguments <-- you used the top bad argument there btw ;)
[14:21:02] mikecmpbll: yep and acknowledged that at the same time :p
[14:21:04] mikecmpbll: that makes it okay!
[14:21:36] mikecmpbll: my other argument was point 2 of the good reasons.
[14:21:44] mikecmpbll: but not as though i've given it all much thought.
[14:22:05] workmad3: mikecmpbll: well, you failed to acknowledge that you may be having various problems without realising it because mysql likes to silently do shit wrong without telling you ;)
[14:22:17] nettoweb: guys, can someone help me convert this sql to AR? delete from tags t where t.id not in (select distinct(tg.tag_id) from taggings tg )
[14:22:41] mikecmpbll: i'm not particularly sure it's a problem if it's not causing any problem.
[14:23:32] muhammadn: nettoweb: you can still use raw SQL statements like the above in rails.
[14:23:41] workmad3: mikecmpbll: ever been aware of mysql silently inserting unspecified values into columns you've marked as NOT NULL and then not specified?
[14:23:52] workmad3: mikecmpbll: and would you call it a problem if it was happening and you hadn't spotted it?
[14:23:57] workmad3: mikecmpbll: because that's default behaviour...
[14:24:03] nettoweb: muhammadn: yes, it???s just to undertand AR
[14:24:18] mikecmpbll: i'd consider anything a problem that has a lasting negative effect whether i noticed it or not
[14:24:34] momomomomo: workmad3: http://www.slideshare.net/SergeyPetrunya/mariadb-10-0optimizer
[14:24:58] momomomomo: not saying it???s perfect, but that specifically doesn???t seem to be a huge issue as grimoire makes
[14:25:04] momomomomo: then again, maybe it still is
[14:25:30] workmad3: momomomomo: they have a generic query planner that can't take into account engine-specific optimisations
[14:25:45] workmad3: momomomomo: unless mariadb have managed to alter that while staying compatible with mysql
[14:26:06] momomomomo: right, but it seems that the engine independent statistic aggregator implemented in 10.0 will optimize for the performance gains
[14:26:49] sysx1000: When I found that people focused on INSERT DELAYED (and other DELAYED stuff), I asked team to focus on PostgreSQL discoveries and then we finally moved away from the idea of using MySQL (MariaDB) in our project
[14:28:14] workmad3: momomomomo: mostly, I think grimoire is pointing out that all of this together makes for an unreliable, difficult to predict database that will do odd stuff to your data without telling you
[14:28:33] workmad3: momomomomo: the bad design is more like 'here's some of the reasons why I think this happened' :)
[14:28:37] mikecmpbll: actually one real world problem i have had with mysql is that it seems to fail miserably at optimizing count(*) queries to the degree that SELECT count(*) FROM (INNER QUERY) is almost always faster than not nesting.
[14:29:28] workmad3: mikecmpbll: I've personally encountered mysql throwing away data silently and acting as though nothing went wrong twice that I've noticed
[14:29:46] momomomomo: workmad3: I???d actually be interested in hearing a discussion about this in #maria
[14:29:47] workmad3: that's twice as in two systems, not twice as in only two events
[14:29:56] momomomomo: I???ll ask if you won???t :p brb
[14:30:09] workmad3: ACTION joins #maria to observe :)
[14:30:23] mikecmpbll: ooh, fun! i've never noticed anything obscure like that, but like you say maybe i'm just oblivious.
[14:30:40] workmad3: mikecmpbll: one of them was where the dev had been stupid and make an ID field a BYTE
[14:30:59] workmad3: mikecmpbll: and mysql just went 'oh, the next ID doesn't fit... throw away the insert... no, no, it went fine, don't worry'
[14:31:44] mikecmpbll: haha. just sweep it under the carpet.
[14:32:05] workmad3: yeah, that's mysql's default mode... which is one of the main reasons I'll personally not touch it again
[14:32:16] workmad3: because I doubt they're going to change those defaults because 'backwards compatibility'
[14:32:35] momomomomo: Doesn???t seem too busy in that channel
[14:34:37] workmad3: mikecmpbll: auto-truncating strings was another one I've encountered... and that was a real PITA because it's pretty hard to spot until you've lost a fair amount of data
[14:34:37] mikecmpbll: is there a way to make .dup on activerecord objects not wipe out timestamps ?:(
[14:35:08] workmad3: did you try .clone ?
[14:36:21] _lazarevsky: workmad3: ok so that did not work!
[14:36:32] _lazarevsky: workmad3: mate please stop with the riddles I really need to push this code ASAP!
[14:36:37] helpa: _lazarevsky: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[14:36:37] workmad3: _lazarevsky: !code
[14:36:40] _lazarevsky: workmad3: I will optimise at a later stage!@
[14:37:05] workmad3: _lazarevsky: btw, the deadline is your concern, not mine :P
[14:37:45] _lazarevsky: workmad3: https://gist.github.com/anonymous/bee9deba4600056b0bc2
[14:37:55] _lazarevsky: get_user is the method I wanna skip if the route is /ping or /sping
[14:38:17] workmad3: _lazarevsky: line 21
[14:38:33] workmad3: _lazarevsky: take a quick guess as to what you *should* be passing to it
[14:38:42] mikecmpbll: haha, poor form man.
[14:39:46] workmad3: _lazarevsky: gold star! :P
[14:40:02] _lazarevsky: workmad3: http://apidock.com/rails/v4.0.2/AbstractController/Callbacks/ClassMethods/skip_before_action <- how on earth was I supposed to infer that from the official docs.. Jayzus!!
[14:40:13] goatish_mound: think out what you wrote
[14:40:26] goatish_mound: how would it ever know you wanted to skip get_user if you never once mention it
[14:40:47] workmad3: _lazarevsky: it would help if you were actually *on* official docs
[14:40:53] workmad3: _lazarevsky: apidock != official docs
[14:41:10] _lazarevsky: workmad3: so skip_before_action in the ping controller
[14:41:14] _lazarevsky: which methods does it apply to?
[14:41:27] _lazarevsky: or ANY method in the ping controller?
[14:41:50] workmad3: _lazarevsky: it's the same as with any other *_action method
[14:42:07] goatish_mound: if you pass no arguments, it would apply to all. since it would have zero idea what one to skip.
[14:42:16] goatish_mound: if you pass arguments... it would follow them.
[14:43:16] _lazarevsky: ok it should have been called: skip_the_action_defined_in_the_before_action_directive_called:
[14:44:22] goatish_mound: do you understand how method calls and arguments work in ruby?
[14:44:46] goatish_mound: not trying to be funny
[14:44:48] workmad3: _lazarevsky: no... but I somewhat agree that the language is a bit more ambiguous with the change to before_action compared to the older before_filter
[14:45:11] goatish_mound: workmad3: how so?
[14:45:12] sysx1000: I am giving up starting Locomotive CMS. It???s beyond me
[14:45:40] _lazarevsky: I took it to mean "skip_and_execute_this_action_before_any_of_the_before_action_actions"
[14:49:51] Aristata: Hey guys, anyone know of an image upload/cropper that plays nice with carrierwave and carrierwave-datamapper?
[14:53:20] EminenceHC: Rolify has a .with_role(:rolename) query. How would I use this in an includes? For example Foo.includes(:user).where(users: {with_role: admin}) ?
[14:55:37] makerop: EminenceHC, start with the User
[14:56:59] makerop: User.with_role(:role, :scope)
[14:57:02] EminenceHC: makerop: Maybe, but I want to print a list of TimeCards, not Users.
[14:58:33] EminenceHC: .where(users: {active: true, has_role: :admin}) is not giving me a syntax error it might work :P
[14:59:12] Macaveli: Is it possible to create a file that bundles js files like "//= require ..." anywhere?
[14:59:28] Macaveli: for example i have 6 js files for rails admin
[15:02:27] claudiop: Hi. Newbie question: How does a controller distinguishes between two different actions in the exact same url? I am following the "getting started" guide, and if i go to the article controller after filling a form for a new one (articles#create) it processes, but after an F5 press, it doesn't knows what to do
[15:02:47] claudiop: How did rails knew that i wanted to create an article(besides the referrer url)?
[15:06:16] makerop: EminenceHC,
[15:06:17] makerop: Quote.joins(:user).where(:users => { :id => User.with_role(:customer) } )
[15:06:22] makerop: something like that?
[15:06:44] EminenceHC: makerop: Ill try that.
[15:07:58] makerop: lemme know
[15:08:09] makerop: curious if that works for sure
[15:10:27] EminenceHC: makerop: It seems to have because no errors but I need to finish the rest of my query to make sure. Thanks, I will let you know.
[15:11:36] helpa: claudiop: http://guides.rubyonrails.org/routing.html - Rails Routing From the Outside In - Rails Guide - by Mike Gunderloy
[15:11:37] pontiki: claudiop: !routing
[15:11:55] greengriminal: trying to use the formTagHelper and wondered if you can you use the button_tag to render a particular action?
[15:11:58] pontiki: claudiop: that discusses how rails knows which action to call in which controller
[15:12:04] walidvb: hey guys, having more assets issues...
[15:12:11] greengriminal: I know you can do button_to 'Print', action: 'print_example'
[15:13:39] claudiop: pontiki: Thanks. I still find it quite hard to understand. Hate being a newbie :)
[15:15:16] smd4298: What is best CMS for rails?
[15:15:32] EminenceHC: makerop: That worked! Thanks, I didnt know it could be done like that.
[15:16:51] pontiki: claudiop: everyone was new, once. :)
[15:19:13] walidvb: i've created a second layout called reader.haml.html, and i've added a new stylesheet called reader.css, but it's loaded as http://reader-ph.herokuapp.com/stylesheets/web_reader.css
[15:19:20] walidvb: instead of the asset path..
[15:20:10] greengriminal: So my issue is that using the button_to (L15) is not showing: https://gist.github.com/anonymous/dfe8dd809c2220402aa8
[15:20:28] walidvb: my files are as follows: https://gist.github.com/walidvb/18aded8c7c75aa3bd3f0
[15:20:33] greengriminal: whereas using the <%= button_tag ... %> works but i cannot assign the action to tit.
[15:21:18] greengriminal: *it. I get the fact that button_tag is part of the FormTagHelpers and button_to is part of the FormHelpers. I am also aware that the difference is that FormHelpers allow you to directly work with your model object
[15:22:35] greengriminal: whereas if you're not directly working with the model object then you that's when you may need to use the FormTagHelpers.
[15:24:53] pontiki: button_to is part of UrlHelper
[15:25:06] pontiki: it will actually generate a form
[15:25:17] pontiki: so you don't use it inside another form
[15:25:44] pontiki: perhaps you meant just button to use inside a form?
[15:27:12] greengriminal: pontiki: yes I did also notice that also. That button_to creates a form.
[15:27:44] greengriminal: In which case I am trying to append an action to the following: <%= button_tag 'BBBB', :class=>'btn primary reg pull_right alone' %>
[15:28:08] greengriminal: but looking on api_docks it doesn't seem to highlight you can do such thing.
[15:28:10] pontiki: what i don't see is where does your form end?
[15:28:50] pontiki: button_tag does not include an action, just like an HTML <button> tag does not
[15:29:10] greengriminal: pontiki: http://apidock.com/rails/ActionView/Helpers/PrototypeHelper/form_remote_tag
[15:29:36] centrx: Web Console looks really useful
[15:30:09] greengriminal: yeah that's part of the new rails release
[15:30:58] makerop: looks awesome
[15:31:00] greengriminal: I will go bury my head in sand now.
[15:31:15] makerop: will make the transition to sublime text easier
[15:31:22] greengriminal: responders looks cool also.
[15:32:38] mikecmpbll: is there a reasonably simple way that i can find the persisted record that is causing a uniqueness validation failure?
[15:32:50] mikecmpbll: for a given instance that failed to save
[15:33:20] mikecmpbll: would be fairly simple but for scoped uniqueness validations
[15:33:23] workmad3: mikecmpbll: Model.where(unique_column: self.unique_column).first ? :)
[15:34:02] workmad3: greengriminal: you know that responders have been around since rails 3.0, right?
[15:34:20] mikecmpbll: yeah, need to do it on the fly not hardcoding the unique columns. i think i'll have to get them out the validation
[15:34:53] workmad3: mikecmpbll: yeah, I'm not aware of a simple way to grab the scope out of a uniqueness validator
[15:35:10] xsannyx: Are there any great solutions for a facebook-like push notification system?
[15:35:27] greengriminal: workmad3: no i didn't.
[15:35:51] workmad3: greengriminal: rails 4.2 are moving them out of core is all
[15:36:06] greengriminal: ah right okay.
[15:36:40] EminenceHC: In my table I am trying to group and sum by user. There should only be ONE row for Jaime Cunningham and the last column should be a sum of all the numbers (payroll_hours) currently in the table. How can I change my query achieve this? Here is my table: http://img42.com/wFv3q and the code is here: https://gist.github.com/EminenceHC/105bbf31d62f54bab1e9
[15:36:48] EminenceHC: http://img42.com/wFv3q
[15:37:33] Jon30: is there a way to search within serialized fields? for example, serialized field "city" is [1,2,3,4] and i am trying to find all fields that have [2,3], so [1,2,3,4] would return in the result.
[15:37:50] workmad3: EminenceHC: well, it would help if your query had any group or sum clauses... :P
[15:38:43] workmad3: EminenceHC: that said, the date will be difficult to achieve for this, because there won't be a single unambiguous date for each record
[15:38:44] Scient: Jon30: no
[15:38:50] EminenceHC: workmad3: I was thinking about grouping by User, but how would I get the sum of payroll_hours and have it display on only one line?
[15:39:07] EminenceHC: workmad3: Or should this be handled in the view layer?
[15:40:16] workmad3: EminenceHC: .group(:user_id).select("daily_time_cards.user_id, SUM(daily_time_cards.payroll_hours") would be a start
[15:40:19] EminenceHC: workmad3: I dont need to group by date, the query just looks for all records within a date range.
[15:40:33] workmad3: EminenceHC: I was meaning more that you can't get the date out of the result
[15:40:46] EminenceHC: workmad3: I see, that is fine. Ill try that query.
[15:41:30] workmad3: EminenceHC: but adjusting that select to be '.select("daily_time_cards.user_id, SUM(daily_time_cards.payroll_hours" AS payroll_hours, MIN(daily_time_cards.date) AS date)' would mean that each record would get the start-date
[15:42:04] workmad3: EminenceHC: changing the MIN to a MAX would alter things so that the date was the latest entry date for the period btw
[15:43:15] EminenceHC: workmad3: Can I use a .group(:user_id) or do I have to use .group(users: {:user_id}) ?
[15:43:41] workmad3: EminenceHC: users don't have a user_id field :P
[15:43:49] EminenceHC: workmad3: DOH oops
[15:44:15] andrew9183: i'm doing a before_update check, and i need to raise an error - how can i implement this
[15:44:27] EminenceHC: workmad3: PG::GroupingError: ERROR: column "daily_time_cards.id" must appear in the GROUP BY clause or be used in an aggregate function
[15:44:59] workmad3: EminenceHC: errr... did you alter the select to have 'daily_time_cards.id' instead of user_id?
[15:45:30] EminenceHC: workmad3: No, using: runquery = runquery.group(:user_id).select("daily_time_cards.user_id, SUM(daily_time_cards.payroll_hours")
[15:46:01] workmad3: EminenceHC: did you fix the SQL error there? :)
[15:46:11] workmad3: EminenceHC: because I just noticed I'd made one...
[15:46:29] EminenceHC: workmad3: Same error if I just use runquery = runquery.group(:user_id). I am using Postgres does it matter?
[15:46:47] workmad3: EminenceHC: yes... that's why I was giving a fairly specific select, on the assumption you were using postgres
[15:47:45] workmad3: EminenceHC: basically, you can't have something in the SELECT clause that isn't also in the GROUP BY clause or being fed into an aggregate function (count, sum, min, max, etc.)
[15:48:08] workmad3: EminenceHC: but I did make a fubar in the .select I typed in-chan
[15:49:22] EminenceHC: workmad3: I cant figure out why simply runquery = runquery.group(:user_id) returns that error.. should I be using group_by?
[15:49:35] workmad3: EminenceHC: I just told you why it returns that error...
[15:49:59] workmad3: ACTION sometimes wonders if he's just talking to himself
[15:50:10] EminenceHC: workmad3: I dont follow because I dont have something in the SELECT clause at all.
[15:50:32] workmad3: EminenceHC: you don't think that there's a default value? :P
[15:50:36] centrx: EminenceHC, Look up how SELECT GROUP BY works
[15:51:08] centrx: EminenceHC, The fields in the SELECT clause ( .select() ), need to match up with the fields in the GROUP BY clause ( .group() )
[15:51:11] workmad3: EminenceHC: seeing as an SQL select without a select clause isn't valid and all that... it kinda makes sense that ActiveRecord provides one :P
[15:51:16] Pupeno_: Each unicorn has its own database connection, right?
[15:51:17] EminenceHC: This is what I get for learning active record queries before raw SQL queries.
[15:51:33] centrx: EminenceHC, The SELECT clause requires an aggregate function: SELECT x, y, COUNT(*) FROM table GROUP BY x, y;
[15:51:53] centrx: EminenceHC, This is equivalent to Model.select("x, y, COUNT(*)").group("x, y")
[15:51:53] workmad3: EminenceHC: you can always call .to_sql on a query object to see the SQL it will produce btw
[15:52:20] centrx: EminenceHC, tail -f log/development.log to follow the SQL queries as your app runs
[15:53:15] workmad3: Pupeno: it's generally advised to re-establish the AR database connection in your unicorn.rb with an after_fork block
[15:53:23] workmad3: Pupeno: especially if you're pre-loading the app
[15:53:44] Pupeno: workmad3: ah... right... I'm actually doing that.
[15:53:47] workmad3: Pupeno: but other than that, yes, each unicorn worker will/should have a separate database connection
[15:54:05] workmad3: Pupeno: with unicorn you can also set your database pool size to 1 in database.yml
[15:54:30] workmad3: Pupeno: unless you're reading the same database.yml with something else (like a background worker) that needs a larger pool anyway :)
[15:54:45] Pupeno: With two servers, 30 unicorns each and about 8 delayed jobs each, I seem to be hitting the maximum amount of connections of my PostgreSQL server.
[15:55:16] makerop: if one of my routes is sign_in GET /sign_in(.:format) service/account/sessions#new
[15:55:20] workmad3: Pupeno: yeah... if you haven't forced the unicorn connection pool down, that would be 30 * 2 * 5 + 8 * 2 * 5...
[15:55:45] makerop: what do i start looking at, if when i visit /sign_in, it gives me a no route matches
[15:55:55] Pupeno: workmad3: so, each unicorn would have a pool of connections? 5 connections?
[15:56:46] workmad3: Pupeno: if you haven't turned that down to 1 in the database.yml, yes
[15:57:18] workmad3: Pupeno: no idea how many threads a delayed_job background worker uses so don't know how big a pool it would need
[15:57:38] workmad3: Pupeno: but you probably want to get them using a slightly different db config so you can adjust them separately
[15:57:54] Pupeno: workmad3: as far as I know, the delayed jobs are single threaded. At least, each is running one and only one job at a time.
[15:58:08] workmad3: Pupeno: right, so you could probably use a pool size of 1 for everything
[15:58:50] workmad3: Pupeno: which would drop your connections down to 76 rather than somewhere north of 300 :)
[15:59:22] EminenceHC: workmad3: centrx: So I should have daily_time_card.id in the select and group both, instead of :user_id?
[15:59:36] Pupeno: The constant amount of connections that I see on the server, right now, is around 70.
[15:59:45] workmad3: EminenceHC: no, because that's not what you want to group by
[16:00:01] Pupeno: So I assume the pools are kept mostly empty but every now and then they can be filled up and cause errors
[16:00:09] workmad3: Pupeno: sounds about right
[16:00:32] EminenceHC: workmad3: I see.. runquery = runquery.group(:user_id).select('users.id')
[16:00:38] workmad3: EminenceHC: no
[16:01:14] workmad3: EminenceHC: .group(:user_id).select("daily_time_cards.user_id") <-- try that for starters
[16:01:48] workmad3: EminenceHC: if that still doesn't work, you may find you need to drop the .includes because it's likely screwing up your SELECT clause
[16:02:02] workmad3: EminenceHC: or change it to a .joins anyway
[16:02:16] EminenceHC: workmad3: Ya i tried that but same error. Ill try a joins.
[16:02:30] Pupeno: max connections by postgresql is at 100, psql recommends to not increase it and use pools instead.
[16:03:33] workmad3: Pupeno: well rails already uses connection pooling, but it's a per-process thing
[16:03:55] Pupeno: workmad3: yeah, which is completely negated by unicorn.
[16:04:10] workmad3: Pupeno: in order to get it inter-process, you basically need to introduce a middleware like pgbouncer
[16:04:29] Pupeno: scaling is hard! let's go shopping!
[16:04:36] workmad3: Pupeno: you shouldn't have any real issues bumping that to 150 though btw... which would also be reasonable IMO
[16:05:17] workmad3: Pupeno: as that would give you enough connections for all your current processes, plus enough for them all to be performing a rolling restart of the processes involved
[16:05:17] Pupeno: Yeah, I'll probably bump it to 150, to make sure there's room for some extra background processes we run every now and then and limit the pool sizes to 1 to see what happens.
[16:06:12] EminenceHC: workmad3: Joins works. Now it says missing attribute :payroll_hours. I assumedthat meant I need to add it to my select clause?
[16:06:56] workmad3: EminenceHC: right... now you do '.select("daily_time_cards.user_id, SUM(daily_time_cards.payroll_hours) AS payroll_hours, MIN(daily_time_cards.date) AS date")
[16:07:08] doubleemms_: anybody have any words of wisdom for unbreaking the 153 rspec tests that went red after i got devise/pundit installed? do i want to be looking at helpers or macros or something else entirely?
[16:07:16] workmad3: EminenceHC: which puts the payroll hours sum and the first worked date for the period in as info
[16:07:47] workmad3: EminenceHC: SUM and MIN are aggregate functions, so allowable in the SELECT clause with your group by
[16:07:49] rhizome: doubleemms_: read the error messages, i guess
[16:08:03] EminenceHC: workmad3: Makes sense now. Thank you for your patience.
[16:08:26] workmad3: EminenceHC: yeah, now I think about it, it was probably breaking with the includes when it ran a second query to load the user data
[16:08:47] workmad3: EminenceHC: as that would have overridden the SELECT for the loading query, but nothing else... producing a bad query
[16:09:00] EminenceHC: workmad3: I see.
[16:09:07] _bart: Just wondering, does someone here use a remote VPS box for actual development? So an environment with vim, git and terminal only tools?
[16:09:47] _bart: I like the idea but I don't know of anyone actually doing that, and I wonder how you'd reach the localhost:3000, just open the port and firewall to your ip only?
[16:10:00] workmad3: _bart: that would work, yes
[16:10:11] workmad3: _bart: or you could use an SSH port forward
[16:10:49] _bart: workmad3: if I'd use a $20 linode box for that, would that work?
[16:11:02] _bart: it feels kind of weird to use a box like that
[16:11:07] workmad3: _bart: it is a bit weird, IMO
[16:11:11] Hates_: _bart: It would be weird
[16:11:22] workmad3: _bart: not sure why you'd do it over just having a normal dev env set up on your local machine
[16:11:27] _bart: I wonder how the performance would compare to my old macbook
[16:11:53] _bart: my local machine is quite slow
[16:12:41] workmad3: _bart: I doubt it's as slow as having to round-trip just about everything over a fairly long network connection to do dev
[16:12:42] _bart: 13" mid 2009 MPB
[16:13:03] _bart: 2,53 GHz Intel Core 2 Duo and 4 GB 1067 MHz DDR3
[16:13:08] Hates_: _bart: hmmm that should be plenty for rails dev. although my old '09 MBP had an SSD in
[16:13:12] workmad3: _bart: not to mention that you're also then subject to the whims and foibles of intermittent network slowdowns
[16:13:44] _bart: commands like rails s/g/c could maybe be faster though
[16:13:49] workmad3: _bart: I'm using a late '08 MBP at the moment, and it's absolutely fine... upped the memory to 4gb, put in an SSD... sure, it could be quicker but it's hardly slow
[16:13:56] workmad3: _bart: springify them? :P
[16:14:18] Hates_: _bart: those are always slow unless you use something like spring or zeus
[16:14:23] _bart: I'll take a look but I think they already use spring
[16:14:45] _bart: I wish I could upgrade the RAM (I'm always close to using all the 4GB), but the motherboard doesn't support more..
[16:15:09] workmad3: _bart: it's a *nix machine... it'll always be close to using all 4gb for something
[16:15:20] _bart: an SSD would probably be nice, but if I'm still unable to upgrade the RAM later on it's maybe better to just get a new Air
[16:15:31] umdstu: Why would rails not know about the helper <record_name>(:fixture_name) in the setup() of a functional test
[16:15:42] jsantana: I'm trying to validates :mobile_phone, presence: true, length: { is: 10 } but even if I put 10 digits it returns an error?
[16:15:49] helpa: umdstu: Please do not use fake values, as they can be confusing or misleading. Sometimes both.
[16:15:49] workmad3: umdstu: !fake
[16:15:50] _bart: workmad3: ok, maybe a format/reinstall with yosemite would be a good idea then
[16:16:20] workmad3: umdstu: in this case, it's somewhat confusing :P
[16:16:34] umdstu: haha, yea one sec i'm writing a gist
[16:17:10] joshua__: Hey guys, I have this line in my config/application.rb `config.eager_load_paths += %W[ #{config.root}/lib/*.rb ]` , is that actually going to pull in any .rb files from that dir or do I need a glob or something?
[16:17:18] joshua__: @workmad3 :P
[16:18:05] contextio: jsantana validates :mobile_phone, :presence => true, :length => { :minimum =>10 }
[16:18:11] contextio: but remember phones can be more than 10
[16:18:22] workmad3: joshua__: no, that just wouldn't work at all
[16:18:30] jsantana: I'll try that
[16:18:32] workmad3: joshua__: it's eager load *paths*, not files
[16:18:49] contextio: dont forget if your not putting an input mask people may use dashes or put in 1 at the beginning
[16:18:57] joshua__: sorry, typo, I am using "config.eager_load_paths"
[16:19:00] workmad3: joshua__: so unless you happen to have directories under lib called stuff like 'foobar.rb'...
[16:19:10] workmad3: joshua__: no, I was pointing out that it's paths, not files
[16:19:25] workmad3: joshua__: and so trying to glob *files* just won't work
[16:19:31] umdstu: workmad3: https://gist.github.com/umdstu/561ea22fd89f7610e413
[16:19:57] joshua__: I see what you mean
[16:20:22] workmad3: joshua__: it also doesn't avoid any of the issues I pointed out yesterday :P
[16:20:38] joshua__: yesterday? today! :P
[16:20:42] workmad3: was it? ok :)
[16:20:47] joshua__: hah, indeed
[16:20:54] joshua__: ACTION scrolls up.
[16:21:14] workmad3: ah, this morning
[16:21:18] umdstu: workmad3: http://guides.rubyonrails.org/testing.html#setup-and-teardown ... its one of those magic helpers .. doesn't seem to exist
[16:21:19] workmad3: feels like ages ago :P
[16:21:54] joshua__: doh, I got d/c so no scrollback
[16:22:08] workmad3: joshua__: have a look at /topic ;)
[16:22:44] workmad3: umdstu: hmm... you haven't turned off fixtures in test_helper.rb have you?
[16:23:26] umdstu: workmad3: no i dont see fixtures referenced anywhere in the file
[16:25:58] jsantana: is there any other way to validate other than in the example.rb model?
[16:26:24] helpa: jsantana: If you want help with your problem you're going to have to provide more context, such as code, stacktraces or further explanation.
[16:26:24] workmad3: jsantana: !context
[16:26:47] workmad3: umdstu: hmm... not sure then, I'm afraid. I don't use minitest, and I don't use rails fixtures
[16:26:49] contextio: you can validate anywhere you want
[16:27:19] contextio: but the ideal flow is to validate before in your form so theres not even a chance of processing it
[16:27:22] contextio: keep it clean
[16:27:35] jsantana: that's with js right?
[16:27:37] umdstu: workmad3: i dont usually, it was just auto generated file from a scaffold that i forgot was there until i ran tests, and saw the errors
[16:27:39] workmad3: contextio: you can't rely only on client-side validation
[16:27:43] workmad3: contextio: it's easily bypassed ;)
[16:27:46] contextio: then have a secondary in your controller
[16:27:51] contextio: i was getting there workmad3 ;)
[16:28:07] workmad3: jsantana: I quite like using form objects personally, e.g. the reform library
[16:28:13] contextio: rely on client = unreliable
[16:28:23] workmad3: jsantana: that lets you put the validations on something server-side that corresponds to the form
[16:28:31] contextio: jsantana js is one way sure...
[16:29:29] workmad3: jsantana: JS is used to make it nicer for users... validations there let the user know something is wrong before submitting it
[16:29:40] contextio: just make sure and standardize your input however you do it, phone numbers seem simple until you get half million records not standardized and try to run a query
[16:29:49] workmad3: jsantana: but you can't rely on them, so you also have to validate the data once it makes it to your server and before you save it
[16:30:08] workmad3: jsantana: default rails stack, that will happen in the activerecord model or some other activemodel type object
[16:30:32] jtperreault: folks familiar with slim-lang, how can i interpolate execution of a block of ruby code?
[16:30:41] workmad3: jsantana: but that's not the only way to do it... you can write your own validations at any point if you so desire
[16:31:03] contextio: there are gems as well jsantana that will help with all as well, but id suggest spending a little time doing it yourself before going to a gem
[16:35:05] rakm: any recommendations on libs/gems to use to implement websocket endpoints in a REST api?
[16:36:19] gizmore: nice question :)
[16:36:23] contextio: https://github.com/websocket-rails/websocket-rails
[16:36:46] contextio: http://blog.pogoapp.com/websockets-on-rails-4-and-ruby-2/
[16:37:28] contextio: but have never used it, just in the vault of crap i have
[16:41:57] brownbathrobe: anyone know anything about missing Capybara methods when running rspec tests?
[16:42:02] brownbathrobe: ie: undefined method `feature' for main:Object
[16:43:38] bricker`work: brownbathrobe: is that file in the "features" directory?
[16:44:12] brownbathrobe: bricker`work: yes, it's in spec/features
[16:44:49] brownbathrobe: bricker`work: i have a .rspec file in the root of the project which contains --require spec_helper
[16:45:45] bricker`work: brownbathrobe: have you required capybara/rspec in your spec_helper?
[16:46:45] brownbathrobe: bricker`work: i had required capybara/rspec but got a "circular require considered harmful" error
[16:46:55] brownbathrobe: bricker`work: the tests did run, though
[16:55:18] rakm: contextio: thanks, didn't flip back to this window till now. I looked at websocket-rails, also seeing things liek Pushr and Faye
[16:55:33] rakm: I'm actually a little unclear on if "pub/sub" and "websockets" are referring to the same thing
[16:55:57] rakm: is it correct to say that pub/sub is a technique that takes advantage of websockets tech?
[16:56:02] rakm: or am I missing something?
[16:56:32] dllama: anyone experience memory allocation issues? getting that when trying to parse .xls
[16:56:51] dllama: more importantly, on what would be the recommend fix for it? :/
[16:56:56] contextio: fayre is more browser based network transport than just websocket its based on node last i checked
[16:57:30] contextio: pub/sub in general is just that and you usually have a broker
[16:58:00] contextio: ok, let me deal with this how i usually do everything
[16:58:02] contextio: whats the problem
[16:58:34] rakm: no problem or specific question really :) just probing a little bit to get a better understanding
[16:58:57] contextio: there is always a problem your trying to solve , so the context helps in application
[16:59:05] rakm: setting up a json api that is expected to push data to clients using websockets
[16:59:12] contextio: there ya go
[16:59:17] rakm: brb, in transit. irccloud will be open
[16:59:28] contextio: are these sockets browsers or clients
[16:59:49] dllama: https://gist.github.com/mvoloz/2e44ca640ae9b7913fd8
[17:00:02] dllama: if anyone can point me in the right direction with that, would be greatly appreciated
[17:01:13] contextio: first guess...memory error lol
[17:02:25] dllama: contextio: i dont think thats teh case, its a 100kb xls file, and i have no issues reading it via File.read
[17:12:13] dllama: hmm, i think its that xls file in particular,
[17:12:32] dllama: just used Roo::CSV to open a csv 2x bigger and it loaded instantly
[17:14:55] rakm: contextio: i don't know what you mean by socket browser vs client
[17:15:47] pskrz: sass and haml are fighting
[17:16:42] railnubyist: Anyone used dokkufy and know how to get it to recognise a different ssh port than 22?
[17:17:05] contextio: rakm websockets in general are used for duplex communication
[17:17:35] contextio: so are you sending and recieving information from browsers or daemons/clients
[17:18:01] spamotuve: Hello, can you please help me with this? http://stackoverflow.com/questions/25410718/how-to-create-suburi-with-passanger-and-apache-for-rails-4
[17:19:16] rakm: contextio: we'll be sending receiving info from a browser and possibly mobile apps. Is "socket browser" different than normal browser?
[17:19:40] contextio: ok so why not just look into node/socket.io etc etc
[17:19:48] contextio: you cant really do REST based websockets
[17:20:01] contextio: while similar the aspect of rest in general is send, recieve then send
[17:20:34] contextio: unless you are avoiding RESTful HTTP all togetehr
[17:20:48] rakm: we already have most of the rest endpoints setup, the websockets is an additional feature on top of that
[17:21:03] bwr: I've been searching for this, but I must be using the wrong term or something. Is there a way to to specify what class should be returned from an active record query
[17:21:49] rakm: there are some complex business rules already built into the rails api. I guess what we really want is to be able to push out updates
[17:22:03] contextio: rakm not going to argue with your logic but REST is stateless so real time communication does not exist
[17:22:17] contextio: kk that makes more sense then
[17:22:43] rakm: yeah, I'm still understanding what exactly i'm doing :) appreciate being able to talk about it
[17:23:00] contextio: so your not necessarily looking for real time communication just able to push as well as recieve
[17:23:15] rakm: yes, I think that is correct
[17:23:26] rakm: when someone does something, tell everyone else about it
[17:23:54] rakm: basically I think many people will be modifying data at the same time
[17:24:07] contextio: alright so are you wanting something you develop or would you be willing to work with a service that does exactly that
[17:26:00] rakm: Happy to work with a service that does exactly that. We have some complex authorization/permissions logic, so it would need to be able to take advantage of that implementation
[17:26:08] rakm: but something off the shelf is fine
[17:26:55] rakm: yeah, just got confirmation that ws channels are only for pushing updates
[17:27:00] contextio: pubnub, pushr
[17:28:23] contextio: there is more out there of course
[17:28:38] contextio: but if you start down that path you probably will run across quite a bit you could use
[17:28:50] contextio: and at the very least give you the direction you can look into if you decide to roll it in house
[17:30:52] contextio: pusher sorry
[17:35:14] rakm: i've heard both those names. will take a look. thanks for the help contextio !
[17:35:21] mikecmpbll: rails 4.2 is well exciting, like. ??????
[17:35:31] contextio: anytime i love api integrations
[17:36:13] mikecmpbll: the web console looks fun
[17:36:28] ckboii89: Hi, can anyone possibly explain why my array of hashes is not being returned properly as json when made through rails console?
[17:37:30] ckboii89: im using angularjs on the front end, and when i call the get request for the data, the first element doesn't actually return the contents, but rather the character?
[17:38:14] helpa: ckboii89: 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.
[17:38:14] mikecmpbll: ckboii89: !code
[17:38:59] dllama: contextio: found teh issue i had, it was specifically the .xls format, saved it as .xlsx and it loaded fine with no memory issues
[17:39:19] contextio: who would have thought lol
[17:41:01] jrhorn424: Does anyone have an example of a ransacker or custom predicate that I can use on a search form hidden field to add a "IS NULL" restriction to a ransack query?
[17:41:10] ckboii89: well the thing is.... i dont have any code that physically creates an array of hashes for my data.. i just did it through console
[17:41:41] ckboii89: the data is type string if helps
[17:58:44] bigbobjr: Hi all. I have a question about testing a Rails app on a local server, using Apache to serve static files. My question is about the architecture of where the Rails app should go and where the static files directory should go (I currently have it in /var/www/html). I know this is a noobie question but I've been searching online all morning and am still stuck :P
[18:01:55] contextio: bigbobjr i mean fundamentally you can put it wherever you want
[18:02:16] contextio: are you using passenger at all
[18:02:58] jrhorn424: Nevermind. Just saw Arel has predicates "null" and "not_null".
[18:03:32] jsantana: contextio, sorry for not replying
[18:03:39] jsantana: was kinda busy xD
[18:04:10] contextio: jsantana no worries technically i am too but ADD is great for multitasking ;)
[18:04:17] jsantana: but yes, me and my partner are using a library called devise
[18:04:45] contextio: i use device and pundit pretty regularly so familiar with it
[18:05:15] jsantana: it has validations already built in for email and password if I recall
[18:06:25] jsantana: btw contextio is there a way to add a custom error message to validates :mobile_phone, presence: true, length: { minimum: 10 } ?
[18:06:54] jrhorn424: jsantana i think its "..., message: 'Your custom message here.'"
[18:07:12] jsantana: tried that, gave me an error jrhorn424 let me try and get it
[18:07:20] jrhorn424: jsantana thanks
[18:07:22] contextio: :message => "phone number is invalid please use xxx-xxx-xxxx"
[18:07:24] contextio: something like that
[18:07:45] contextio: or you can do it in your class as well
[18:08:48] jsantana: in a class eh hmmm
[18:09:39] bigbobjr: @contextio no I'm not using passenger. just apache and webrick
[18:09:53] jsantana: also, I have this https://gist.github.com/anonymous/a28639cc946534c99c54 to show errors, but I would like to put the errors in different places, example, first name error should go under the first name field and so on
[18:12:12] contextio: bigbobjr i mean honestly id just use passanger as it simplifies it a lot cause your going to use a lot of rack code to display static stuff
[18:12:18] contextio: https://www.digitalocean.com/community/tutorials/how-to-setup-a-rails-4-app-with-apache-and-passenger-on-centos-6
[18:12:22] contextio: pretty easy tut to follow
[18:13:47] roelof: some one who has a example how I can make a multi-step form the REST way ?
[18:15:18] contextio: roelof you look at http://railscasts.com/episodes/217-multistep-forms?view=asciicast
[18:15:31] SloggerKhan: I'm trying to get up an running with a new git clone of a rails project and rails s just lists usage and options instead of trying to serve the app in dev mode.
[18:16:11] contextio: what does rails server do ?
[18:16:23] jsantana: contextio, is there a way I could for example the error message for first name to be under the first name field?
[18:16:31] SloggerKhan: maybe I need to run rake first?
[18:16:40] SloggerKhan: Rails server usually starts the dev server
[18:16:51] SloggerKhan: rake db:create
[18:16:52] contextio: no i mean if you type it out instead of S
[18:16:57] contextio: bundle install first
[18:17:07] SloggerKhan: I did bundle install
[18:17:18] roelof: contextio: and then I have to make myself something so the user can see how many steps there are and where the user is ?
[18:17:42] contextio: jsantana you could i assume if you setup a div there and parse the error message out in that div
[18:18:13] contextio: roelof easy way to do that is just update a step indicator at the top on page
[18:18:20] contextio: so 1,2,3 or something along that lines
[18:18:33] contextio: so when you submit the form and its successful just render step 2 or something
[18:19:02] contextio: i think that railscast covers that all
[18:19:21] contextio: alright i gotta go grab some lunch..its freaking late
[18:21:46] coderhs: Hey i am getting an ActiveModel::ForbiddenAttributesError while running where command within a model
[18:22:40] helpa: contextio: 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.
[18:22:40] pipework: contextio: !code
[18:24:47] bigbobjr: @contextio thank you!! u r awesome :)
[18:32:03] benlieb: how can I get protocol-less urls? I.e. //domain.com/foo/bar
[18:35:35] lilia: belieb: pass protocol: false
[18:35:56] coderhs: hey i noticed my problem in my rails application https://gist.github.com/coderhs/1e38d8c23cb44f69dd5b
[18:36:33] coderhs: the function used to work properly before but broke after the update
[18:36:34] roelof: contextio: thanks
[18:40:58] alaing: I cant seem to find a good updated tutorial on unicorn
[18:48:37] stef1a: i'm unsure why i'm getting this syntax error, which i hadn't been getting until i updated to bootstrap3 and replaced form_for with bootstrap_form_for: https://gist.github.com/smlance/61f37c03039487427ae0#file-_update_submission_status-html-erb-L9
[18:48:45] rhizome: coderhs: isn't it .try?(...)
[18:49:37] coderhs: rhizome: didn't get you
[18:51:39] stef1a: never mind. the hide_label: true, is the culprit
[18:52:49] hfp: Hey all, the elasticsearch gem github says to `Install the elasticsearch-model and/or elasticsearch-rails package from Rubygems`. I want to use elasticsearch on an ActiveModel. Should I also install elasticsearch-rails or is elasticsearch-model enough? I find the wording confusing
[19:00:51] slash_beep: hfp i personally just use elasticsearch-ruby, which I think consists of elasticsearch-transport and elasticsearch-api...
[19:01:34] jsantana: Could anyone answer me this: http://stackoverflow.com/questions/25412443/custom-validation-error-messages-for-rails-and-their-location
[19:10:00] hfp: slash_beep: Oh yeah, that's enough to get it going in Rails?
[19:10:49] momomomomo: or, if you want to use solr: https://github.com/sunspot/sunspot
[19:11:30] momomomomo: http://solr-vs-elasticsearch.com/
[19:13:45] walidvb: i don't get it... i have this route: book_bookmark_alone GET /books/:book/bookmark(.:format) bookmarks#get
[19:14:03] walidvb: which doesn't work, when I use this in a test: get book_bookmark_alone_path :book => @book
[19:14:32] walidvb: browsing to it works(ps: my controller has respond_to :json , i'm not tooo familiar as to how it all works..)
[19:15:06] hfp: walidvb: try with a rails console
[19:16:02] walidvb: hfp: i tried binding.pry within the test
[19:16:51] walidvb: hfp: there is no method get or _path in the console.
[19:18:23] mnms_: Guys how I can use helper methods in sidekiq worker
[19:18:36] mnms_: I tried to include ApplicationHelper...
[19:19:02] emptybits: how would I go about adding a parameter to a url when the url wasn't generated by rails? is there a helper for that?
[19:19:14] hfp: walidvb: Sorry don't know how to help you
[19:19:23] walidvb: get :get, {:book => @book}
[19:19:32] walidvb: first argument of get needs to be an action
[19:20:42] sdegutis: What's the recommended way to run a Rails app in production?
[19:21:02] waseem_: sdegutis: That's a vague question.
[19:22:29] sdegutis: Sorry. First of all, should we use webrick (the default), or something else?
[19:22:48] sdegutis: Second, are there secondary tools that should generally be used by most apps? Nginx? Memcached?
[19:23:35] waseem_: seanmarcia: Webrick is not recommended in production. You should use someting like unicorn, passenger or puma.
[19:23:45] Scient: scratch puma, its flaky :P
[19:24:22] waseem_: sdegutis: Nginx is a web server and a web server will be used by all Rails application[citation needed].
[19:24:36] waseem_: sdegutis: Most of the application don't need Memcached.
[19:24:45] waseem_: Scient: I believe you.
[19:24:55] sdegutis: So Unicorn or Passenger then, eh?
[19:25:09] sdegutis: https://www.engineyard.com/articles/rails-server
[19:25:10] waseem_: sdegutis: Yes, those are application server.
[19:25:31] _sillymarkets: Anyone work with Viewpoint gem before?
[19:25:41] sdegutis: I assume I will also probably want to run Nginx on top of it for static files, shelling out the remaining requests to either Passenger or Unicorn?
[19:25:59] waseem_: sdegutis: Yes, unicorn is good.
[19:26:14] sdegutis: waseem_: This article recommends Puma.
[19:26:43] waseem_: sdegutis: Read about those and decide yourself. :)
[19:27:11] sdegutis: Oh wait, it requires Rubinius or JRUby.
[19:27:18] sdegutis: Does anyone actually use Rubinius with Rails?
[19:27:21] waseem_: sdegutis: See rading helps.
[19:27:32] sdegutis: waseem_: Noted; will rade more often.
[19:27:44] waseem_: sdegutis: Don'r rade the poor.
[19:27:58] sdegutis: waseem_: I won'r.
[19:31:36] andrew9183: anyone from toronto? :D
[19:34:25] skyjumper: looking for an opinion
[19:34:51] skyjumper: gems adding their own assets to config.assets.precompile - ok idea or not?
[19:34:53] jsantana: anyone here have used devise with rails?
[19:35:05] helpa: jsantana: Don't ask "does anyone use <thing>?". It's better to just state your problem and if anyone has used <thing> they will most likely answer.
[19:35:05] waseem_: jsantana: !used
[19:35:52] microdex: if I have a has_one relationship, how do I include all the columns from the adjoining table
[19:36:12] jsantana: I'm trying to make my custom message for email but since devise library already has it's own custom message already built in I was wondering where could I edit this message?
[19:37:13] microdex: User has_many :cars Car has_one :paint How can I do @user.cars.joins( :paint) and include all the paint specs in my query ?
[19:37:45] microdex: or do I even need joins for a has one relationship ?
[19:40:47] esaym153: anyway I can see what rake db:migrate would do before I execute it? (db is like 20 version behind, everyone been had jamming needed changes...)
[19:44:20] walidvb: jsantana: the email content?
[19:45:36] jsantana: walidvb, yes, because now by default it's bringing CAN'T BE BLANK but if I add a validates :email, presence: {message: "This can't be left in blank."} it will bring both CAN'T BE BLANK and the custom one I added
[19:46:05] walidvb: so the flash you get
[19:46:26] kedric: How would you go about testing if a capybara action triggers an ajax request?
[19:46:34] aarkerio: hi! If I wanna get the current full URL can I use request.original_url ?
[19:46:37] rhizome: esaym153: rake db:migrate:status
[19:46:42] walidvb: iirc you 'd need to ooverride all validations to be able to do that
[19:46:52] walidvb: *devise calidations
[19:47:32] aarkerio: I mean with the protocol and the host: http://www.foo.com/article/234/en
[19:47:46] jsantana: override all validations
[19:47:51] rhizome: aarkerio: i would first ask why you need it
[19:47:51] esaym153: rhizome: well I knew that, the question it, if there are a bunch of undone migrations (but that were done manually by hand), how do I get ride of them?
[19:47:52] jsantana: need my friend google now
[19:48:29] rhizome: esaym153: i don't understand
[19:48:55] gravity13: I???m trying to host a directory within a submodule - not experienced with rails - how would I go about doing this?
[19:49:14] walidvb: jsantana: devise has a set of validation. from what i read, you cannot have both their AND your validations. meaning that to override 1 of their validation, you'd need to rewrite all of them
[19:49:21] walidvb: but i'm not 100%
[19:49:25] mnms_: guys Im fighting with helpers in sidekiq worker without success. In worker class I add Include MyHelper, but it didnt help. Any ideas ??
[19:49:27] aarkerio: I need this: <meta property="og:url" content="#{request.original_url}"/>
[19:49:56] walidvb: aarkerio: that works
[19:49:56] jsantana: walidvb, it would be much easier if I could just find where is the validation message written and just edit that bit...
[19:50:20] esaym153: rhizome: so several people used scaffolding to make new controllers and views, but they never ran db:migrate (they manually made the tables), so now when I try to add a new table,view,controller, db:migrate is going to want to first apply all those other migrations. What will happen?
[19:50:25] walidvb: jsantana: you'd have to monkey patch devise... maybe using locale.yml?
[19:50:28] walidvb: i'm not sure
[19:50:34] lilia: jsantana: config/locales/devise.en.yml
[19:51:00] rhizome: esaym153: they will error. you can delete the files
[19:51:07] aarkerio: the docs says " original_url() . Returns the original request URL as a String."
[19:51:11] esaym153: rhizome: ok, so I just delete the files?
[19:51:30] aarkerio: but I don't know if " original request" means where the user came from
[19:51:38] walidvb: aarkerio: try :P
[19:51:43] aarkerio: or the current page
[19:51:50] walidvb: the current page
[19:52:08] walidvb: lilia: i think those are only for other actions, such as signing_in, etc
[19:52:10] rhizome: aarkerio: i'd use either the opengraph gem or use a named yield through content_for and the usual url helper for that page
[19:52:52] walidvb: rhizome: i use request.original_url, works fine
[19:53:29] benlieb: I have a testing design question
[19:53:45] rhizome: but then you hit a wall if you want to use other OG tags
[19:54:04] benlieb: I have a view that displays some info about specific objets in my db: [1446, 1640, .... , 2687, 917].each do |id| render => :partial ... :locals => {:foo => Model.find(id)}
[19:54:26] rhizome: benlieb: first off, do that find in the controller and do render @foos
[19:54:45] benlieb: but this obviously fails in testing. What is the best way to make this testable?
[19:54:52] benlieb: I could make a helper
[19:55:01] rhizome: why does it "obviously" fail in testing?
[19:55:02] benlieb: and stub the helper...
[19:55:13] benlieb: rhizome: those ids don't exist in test db
[19:55:40] benlieb: rhizome: i like the instance var
[19:55:42] rhizome: then your code is brittle and you should do it another way
[19:55:49] benlieb: rhizome: duh
[19:55:56] benlieb: that's why I'm asking this question :)
[19:56:17] benlieb: so is a stubbed helper the best / only way to do this?
[19:56:29] benlieb: how would I override an instance var from a test?
[19:56:30] rhizome: i don't think so. i never use stubbed helpers
[19:56:40] alaing: I cant seem to find a good updated tutorial on unicorn
[19:57:16] alaing: i have nginx and unicorn working but i would like to learn moree about them
[19:57:17] rhizome: benlieb: not sure what you're asking for. what exactly are you trying to test?
[19:57:49] benlieb: rhizome: It's a functional test that is a pretty simple :get on the page
[19:58:13] benlieb: but this part of the view (the part that has pre-defined ids) fails the test, which is completely expected.
[19:58:28] benlieb: I'm just wondering how to organize the code so that it's testabe
[19:58:38] benlieb: and not sure what the best option is.
[19:58:54] benlieb: making a helper and mocking / stubbing it seems overkill but I can do it
[20:01:16] walidvb: benlieb: wrap it in unless Rails.env.test? :P
[20:02:15] benlieb: walidvb: I don't really like that option. It feels weird to alter the logic of the app for testing. Then you end up with these all around.
[20:02:38] walidvb: you'd be altering the view
[20:02:51] walidvb: but rhizome is right, you should fetch those from the controller.
[20:03:26] walidvb: So you could create new ones in your contrller, and pass those on.
[20:04:00] benlieb: if I create an instance var for that array it will still fail the test. right now my only idea seems to be a mocked helper
[20:04:05] walidvb: or add a :legacy_object column to your db, and load those
[20:04:17] benlieb: walidvb: ?
[20:04:31] walidvb: well, you should load those in your controller
[20:04:48] benlieb: walidvb: with all due respect, you're missing the point
[20:05:35] walidvb: if you don't want to have Rails.env.test? anywhere, you can load objects you know exist, and still "hardcode" those [...] you mentionned, but in the db instead
[20:06:04] walidvb: that's what i did when I had to hardcode object ids in my views.
[20:06:24] walidvb: benlieb: your issue is that you're trying to load objects by ids, that don't exist, no?
[20:07:13] lilia: benlieb: you can totes set a controller instance var from the test
[20:07:27] benlieb: lilia: awesome, how?
[20:08:09] jsantana: lilia, walidvb, I'm having this other error where it's just saving the email and password to the database, is it because devise? also when ever I try to display validation errors, even tho I don't leave any fields empty except the password one (to get the validation errors) I get the error messages for everything except the email
[20:09:58] benlieb: lilia: I don't think this is possible
[20:10:08] rhizome: benlieb: use something other than ids to retrieve the instances
[20:10:25] lilia: benlieb: is it a controller test or a view test?
[20:10:37] benlieb: lilia: controller (functional)
[20:11:00] benlieb: It's not too hard to do a mocked helper
[20:11:08] benlieb: I just was wondering if there were something simpler
[20:11:24] benlieb: overwriting an instance var would be cool, but I don't think you can do that from a test.
[20:11:43] benlieb: unless you can mock it. hm...
[20:13:53] benlieb: :( http://stackoverflow.com/questions/9971192/stub-an-instance-variable-using-mocha
[20:14:12] benlieb: mocked helper it is
[20:15:23] lilia: hmm...maybe im wrong but i thought I remember doing so in a past life...
[20:16:20] lilia: could you do this on the config/environments/... level?
[20:20:14] benlieb: It's really easy to stub the helper:
[20:20:15] benlieb: MainController.any_instance.stubs(:samples).returns([])
[20:20:29] benlieb: just thought there might be even EASIER. :)
[20:21:50] lilia: could store the array in the db....
[20:22:41] lilia: bonus: can build an interface to maintain it and then you dont need to update the app if the ids need to change
[20:26:23] mnms_: How can I check if transaction was commited without using after_commit callback ?
[20:28:12] rhizome: i'd imagine the transaction completing would be enough, but i don't know any deeper than that
[20:28:55] sdwrage: rails 4 includes arel by default now right?
[20:31:35] bricker`work: sdwrage: it always has
[20:31:46] bricker`work: Rails always has, I mean
[20:32:36] sdwrage: bricker`work, scope :voluptuous, -> {where(height: 58...62).where(weight: 120...139).or.where(height:63...67).where(weight:140...159).or.where(height: 68...71).where(weight: 160...189).or.where(height:72...76).where(weight:230...249)}
[20:32:46] sdwrage: tried that but sadly rails doesn't have "or"
[20:32:59] sdwrage: so I have to convert it to arel unlessss you know a better way
[20:34:09] bricker`work: sdwrage: write the SQL or use Arel. The ActiveRecord query interface is very limited.
[20:39:32] pipework: sdwrage: That's, um... how about that.
[20:39:50] sdwrage: pipework, ??
[20:39:58] helpa: sdwrage: You are the worst kind of person
[20:39:58] pipework: sdwrage: !!!!!!!
[20:40:10] sdwrage: I love you too
[20:40:27] sdwrage: pipework, what was that for? lol
[20:40:45] pipework: sdwrage: oh, just the sad about the ranges.
[20:40:58] sdwrage: I shouldn't have ranges? 0_o
[20:41:25] sdwrage: or just mad about what they represent
[20:42:12] pipework: sdwrage: No, just that you have a scope like that that uses these magic values in them.
[20:42:32] pipework: I'd probably put them into a constant and build the scope from that at least.
[20:42:50] sdwrage: pipework, I kinda suck at building complicated queries :P
[20:43:27] sdegutis: Is it difficult to use Rails 4 without using ActiveRecord?
[20:43:35] sdegutis: Will I be losing many features?
[20:43:45] pipework: sdegutis: Only the ones related to activerecord
[20:43:58] sdegutis: But none related to resource caching etc?
[20:45:52] slash_beep: might lose some functionality with form_for... path helpers... probably among others
[20:45:53] sdegutis: pipework: I'm mainly thinking of https://signalvnoise.com/posts/3113-how-key-based-cache-expiration-works
[20:46:06] sdegutis: slash_beep: Perfect, thanks.
[20:46:15] sdegutis: I might just use ActiveRecord in this case.
[20:46:20] pipework: slash_beep: Actually, you won't.
[20:46:25] pipework: activemodel is a great thing
[20:48:02] slash_beep: yeah, you could use activemodel/activesupport/whatever to bring the functionality to any object
[20:49:37] sdegutis: Right now, our app is written in Clojure, and we have one namespace for web stuff, and one for features, and the features namespace contains a rough equivalent to "models".
[20:49:48] sdegutis: I'm thinking of porting this to Rails, and replacing our web namespace with Rails features.
[20:50:13] sdegutis: But our "models" live in our "features" namespace, so I would have to write wrappers around them in our 'web' namespce.
[20:50:31] sdegutis: (Kind of like app/ and lib/ from what I can remember from when I tried Rails 2.x)
[20:51:08] sdegutis: And honestly Rails brings a ton of web-app-specific functionality to the table that Clojure just doesn't have yet (and may never have).
[20:51:22] pipework: sdegutis: Why not go with more clojure stuff?
[20:51:33] pipework: Surely there's enough great things in the whole JVM.
[20:51:40] sdegutis: So I suppose I can make "plain old Ruby object" models in my features stuff, and wrap that in the "web" section using ActiveModel.
[20:52:00] sdegutis: pipework: I've had to do a lot of wheel-reinventing in Clojure
[20:52:24] sdegutis: pipework: it's doable but very error-prone; instead of thousands of Rubyists fixing it up, there's hundreds (sometimes only dozens) of Clojurists fixing it up
[20:52:33] pipework: sdegutis: I'm fairly sure there's enough tools in clojure without needing to reinvent.
[20:52:49] sdegutis: i.e. right now our namespace-reloading is broken and I have no idea why
[20:52:59] pipework: sdegutis: So what's going on that we could help with?
[20:53:02] sdegutis: We're using ring-reload very plainly.
[20:53:24] sdegutis: pipework: I'm just in here to ask questions and get a feel for how I might restructure our app if it was rewritten in Rails
[20:53:49] sdegutis: So far it sounds like I would use Nginx, either Passenger or Unicorn, possibly Memcached (mentioned on https://signalvnoise.com/posts/3113-how-key-based-cache-expiration-works)
[20:53:52] pipework: sdegutis: Oh neat. Well, fire away.
[20:54:17] pipework: sdegutis: I would suggest you pick up either cruby or jruby for your runtime. Jruby has the fun of being on the JVM.
[20:54:35] sdegutis: pipework: isn't cruby just vanilla ruby?
[20:54:35] pipework: Once you decide on which to use, you can make decisions about application servers and the such.
[20:54:40] pipework: sdegutis: You're correct.
[20:54:47] sdegutis: Yeah that's the way I was heading.
[20:55:07] pipework: sdegutis: Then I would suggest looking into thin, puma, and unicorn, in that order.
[20:55:13] pipework: thin for asynchronous stuff, mostly.
[20:55:16] sdegutis: I've seen two camps, one which prefers to do everything inside Rails, and one which likes to only use Rails as the web-front-end to the application logic, which lives independently
[20:55:54] sdwrage: https://gist.github.com/sdwrage/4e3081001261f8affacc
[20:56:02] sdwrage: does that look about right guys?
[20:56:17] sdegutis: I'm hesitant to completely sell out to ActiveRecord and have that entirely dictate my model, but I might if it has enough benefits.
[20:56:28] pipework: sdegutis: You can use activerecord and all of rails and be a part of the second camp.
[20:56:51] pipework: It's about keeping your app away from your dependencies and wrapping those dependencies into adapters that you own.
[20:57:01] sdegutis: pipework: I thought the second camp usually used an ORM external to Rails, and only used Rails for routing basically
[20:57:04] sdwrage: oh wait... I think I screwed up the wheres
[20:57:14] sdegutis: i.e. map /foo/bar to Foo::Bar.call() etc
[20:57:33] sdegutis: pipework: which camp are you in?
[20:57:36] pipework: sdegutis: I'm a part of the latter club. You can do whatever you like. If you'd like, I can describe how I play with not building my app in rails.
[20:57:40] sdegutis: man my carpel tunnel i kicking in bad
[20:57:49] sdegutis: pipework: sure
[20:59:21] pipework: sdegutis: I use rails as the frontend where declare my routes in my routes.rb, then route everything to a single 'controller', which passes all the relevant information to the application. The application has 'edges' for persistence and other non-domain things, and the way the app crosses those edges is via adapters, which are wrappers around dependencies.
[21:00:00] pipework: While you're welcome to have as many controllers as you want, you can get away with one. the application returns a set of objects that are 'presenters', ready for display.
[21:00:31] pipework: Those objects know where their 'templates' (views in rails) are.
[21:00:58] pipework: The controller only handles passing data back and forth, setting http things (statuses, headers, etc.)
[21:01:24] pipework: Some day I'll redo all of this into a rack application
[21:01:33] sdegutis: pipework: it sounds like you're pulling the view out of rails and into the application itself (via an adapter)
[21:01:47] pipework: sdegutis: So, I suggest not doing this if you want the community support part of rails.
[21:01:52] sdegutis: pipework: if so, doesn't that mean you're not taking advantage of Rails mapping your views to your routes for you for free?
[21:02:03] pipework: sdegutis: rails doesn't map views to routes
[21:02:19] sdegutis: pipework: i.e. don't you then have to find the view on disk yourself manually?
[21:02:23] pipework: sdegutis: You'll want to see 'architecture: the lost years' talk by Robert Martin.
[21:02:27] sdegutis: I thought it does convention-based name mapping
[21:02:37] sdegutis: pipework: btw he's my boss, I wrote cleancoders.com
[21:02:43] pipework: sdegutis: oh shit, that's awesome.
[21:02:48] sdegutis: this is the site in question
[21:02:49] lucha: Hello there!
[21:02:56] pipework: sdegutis: Nope, activemodel has methods you can define.
[21:03:14] pipework: sdegutis: See to_partial_path
[21:03:30] lucha: I'm using haml. I want to go to a url when I click on a check box. The url is a _path helper. Is this possible?
[21:04:09] lucha: I need to use the onClick metho
[21:08:40] sdegutis: pipework: I'm surprised that you don't make more use of controllers.
[21:09:01] sdegutis: pipework: our current implementation's "web" namespace is essentially what I would have written in Rails controllers
[21:09:22] pipework: sdegutis: Why? I don't feel like they're that great for anything except passing data back and forth and handling HTTP-specific things.
[21:10:00] pipework: My controllers are practically anorexic.
[21:10:51] sdegutis: pipework: Mine convert HTTP parameters into application-specific params, much like you say; but we have so many routes that it would be a huge file.
[21:11:34] pipework: sdegutis: Maybe you need to extract that into a collaborator?
[21:11:54] pipework: Or is there something different about the controller itself that warrants having multiple controller classes?
[21:12:12] pipework: I'd think that a mapper like that wouldn't be a controller's responsibility.
[21:12:43] goodbomb: anyone know why ??? puts 'ID #{self.to_user_id} already found??? ??? won???t render out the self.to_user_id ? It just prints to the console as part of the string
[21:13:03] sdwrage: are private scopes possible?
[21:13:20] pipework: sdegutis: private class methods are.
[21:13:27] sdegutis: pipework: well there are a lot of different types of routes.
[21:13:35] aarmenaa: goodbomb: looks like you???re using single quotes, you need to use double qotes for string interpolation to work.
[21:14:09] goodbomb: aarmenaa: ah, gotcha, thanks
[21:14:09] pipework: sdegutis: Well, with being in the second camp, I often step outside of the MVC2-style and include things that aren't M, V, or C.
[21:14:23] sdegutis: Thanks pipework.
[21:14:32] pipework: sdegutis: Come back sometime!
[21:14:38] pipework: I'm super curious about 8thlight stuff.
[21:14:43] aarmenaa: goodbomb: any time :)
[21:14:47] aarmenaa: I???m using JBuilder as the view layer to present an API. The responses can sometimes be quite large (an array of ~20k hashes). I was using a partial to format and present the hashes, but inlining the partial was about 5 times faster (3 to 4 seconds vs 15 to 20). My question is this: is testing in the development environment preventing the partial from being cached, or does Rails not cache partials?
[21:14:59] pipework: aarmenaa: Cool kids use serializers
[21:15:29] pipework: aarmenaa: Well, code is reloaded in development, and there might be configuration that disables cache for the environment.
[21:18:48] aarmenaa: pipework: It sounds like you might have a suggestion for a better way to do what I???m trying to do?
[21:19:15] sdwrage: bricker`work, you think I would be able to get something closer to what I needed with the squeel gem?
[21:19:26] pipework: aarmenaa: Not really. Your issue is about caching, I just think serializers are much better than jbuilder.
[21:19:52] aarmenaa: pipework: I thought jbuilder was a serializer. What would you use?
[21:20:04] pipework: aarmenaa: activemodel serializers.
[21:20:13] amh345: anyone here use redis with JsonPath? JsonPath.new("$..config[?(@.host == 'www.testtest1.com' && @.skin == 'S1')]").on(@from_redis) returns null whenever i add the &&.
[21:20:15] pipework: aarmenaa: https://github.com/rails-api/active_model_serializers
[21:23:30] aarmenaa: pipework: Ah, I see what you mean. I???m not sure it works for my use case, as I literally have an array of hashes (no model objects), but I???ll try some things.
[21:24:12] pipework: aarmenaa: Ah interesting.
[21:26:53] amh345: also, it looks like targeting elements using the JSONPath functions differently then an online tester. http://ashphy.com/JSONPathOnlineEvaluator/
[21:31:33] acriax: Has anyone gotten sass-rails 5.0.0.beta1 to work with rails 4.1.4? I'm getting "Asset logical path has no extension: application" from this line: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
[21:35:12] webdestroya: acriax: whats in application.css ?
[21:35:27] acriax: I don't know. Where do I find it?
[21:36:22] lilia: acriax: probably app/assets/stylesheets/application.css.scss
[21:36:46] acriax: oh, I thought he meant the compiled one
[21:37:10] acriax: well, I tried with only "// = require_self" and that didn't work
[21:38:08] lilia: compiled one defaults to public/assets/application<hash>.css, but you're probably not precompiling in development
[21:38:31] phikes: Hi, I recently "discovered" Rails Streaming and I am trying to achieve the following: Say I have a lengthy loop in my view and want to give the browser an interim result. Is that possible somehow?
[21:38:51] phikes: I know Streaming does something slightly different but this led me to the idea.
[21:39:24] ferr: Hello, any grammar nazis here?
[21:41:03] sdwrage: Hey all, using Squeel and for some reason I am getting an error. Does this query look right?
[21:41:05] sdwrage: https://gist.github.com/sdwrage/a6e367d190f1b9024a20
[21:41:37] sdwrage: getting /Users/JustinLonas/projects/gohobbyist/app/models/ad.rb:29: syntax error, unexpected ')', expecting '}' ...129)) | height.gte(72).lte(76)) & (weight.gte(130).lte(149))} ... ^
[21:42:50] lilia: sdwrage: missing open paren on the last height
[21:43:42] sdwrage: lilia, ah thanks :)
[21:45:03] sdegutis: pipework: im back
[21:45:09] sdegutis: pipework: what are you curious about 8L about?
[21:45:37] pipework: sdegutis: Do you get to work with Uncle Bob, or at least people that hold his beliefs?
[21:45:46] pipework: Or are they more pragmatic?
[21:46:17] hahuang65: I can no longer set default_scope to point to another scope I have defined?
[21:46:44] sdegutis: pipework: I haven't worked at 8L for 2 years so I can't be perfectly sure, although I stop by every few months to say hi; but last I worked there, they're all very like-minded, and Bob pairs with the craftsmen there every so often
[21:46:57] sdegutis: pipework: right now I work solely on cleancoders.com, maintaining the website myself
[21:47:51] sdegutis: pipework: here, I work with Bob more often; for a while we were pairing every week on new features to the site; but he's very busy
[21:48:18] pipework: sdegutis: Oh wow, so since you're not at 8thlight, but you're orking with him?
[21:48:21] pipework: That's pretty awesome.
[21:48:41] sdegutis: pipework: well working for him, but yeah
[21:48:48] sdegutis: It's pretty great; he's super smart.
[21:49:20] sdegutis: I've been working at clean coders for about 2 years now, it's been a blast.
[21:50:06] pipework: I'd love to have the chance to show him some of my crap.
[21:51:30] pipework: sdegutis: When you were working for 8thlight, what did you do?
[21:51:35] pipework: What did you work on?
[21:51:46] sdegutis: pipework: mostly legacy Rails apps, some greenfield iOS projects
[21:51:57] pipework: What are the coding standards like?
[21:52:01] sdegutis: pipework: there was a little Clojure; I hear there's a lot more these days
[21:52:10] sdegutis: pipework: in what sense?
[21:53:59] pipework: sdegutis: I mostly hear about his lofty design stuff and OO-related theory.
[21:54:20] sdegutis: Oh yeah, they totally work on adhering to that where possible.
[21:54:35] sdegutis: But a lot of their business is cleaning up legacy Rails apps, in which case there's only so much you can do.
[21:54:44] sdegutis: (And legacy backbone apps, etc)
[21:54:53] pipework: sdegutis: Do they build without the transport (http, rails) first?
[21:54:56] sdegutis: They're huge on TDD and do it everywhere.
[21:55:10] sdegutis: pipework: I can't answer that reliably anymore.
[21:55:32] pipework: Or at least, do they always separate app from transport/framework/libraries?
[21:56:06] sdegutis: As much as is possible under real life constraints.
[21:57:26] slerpnderp: anyone here love troubleshooting dependencies?
[21:58:11] sdegutis: slerpnderp: who doesnt
[21:59:46] pipework: sdegutis: How many people work on cleancoders?
[22:00:04] pipework: just you and bob?
[22:00:13] pipework: How'd you manage to be his numbah one?
[22:00:20] sdegutis: Well it depends on what you mean by work on it.
[22:00:34] slerpnderp: sdegutis: you must be everyone???s best friend
[22:00:38] sdegutis: He makes videos, I do website stuff.
[22:00:47] sdegutis: slerpnderp: not quite:
[22:01:06] sdegutis: slerpnderp: https://www.dropbox.com/s/6cf6zmn4bxcvbz2/friends.png
[22:01:16] sdegutis: slerpnderp: I apparently have 1 friend
[22:01:35] sdegutis: pipework: dunno
[22:02:15] slerpnderp: sdegutis: well, maybe everyon???es favorite acquaintance
[22:02:28] sdegutis: slerpnderp: ha
[22:02:50] slerpnderp: do you have experience with libarchive?
[22:02:54] sdegutis: who doesn't?
[22:02:57] sdegutis: oh wait, me.
[22:03:02] pipework: love me some .ar
[22:03:16] sdegutis: I made a Makefile that makes a .tgz file, does that count?
[22:03:33] sdegutis: https://github.com/mjolnir-io/mjolnir/blob/master/Makefile#L24
[22:03:59] slerpnderp: yeah i think you???re in deep
[22:04:29] slerpnderp: i can???t for the life of me get libarchive to install for my project using bundler
[22:05:30] rakm: anyone know Ryan Bates in real life? I just watched a railscast after a long time and realized he hasn't been around for almost a year now
[22:05:52] sdegutis: https://news.ycombinator.com/item?id=7462865
[22:05:55] pipework: rakm: Not personally, only online. He lived like 20m away, though.
[22:06:44] pipework: m being minutes
[22:08:34] rakm: glad you clarified, i was assuming 20 moons
[22:08:59] sdegutis: coulda been miles
[22:09:05] sdegutis: that's what I thought at first
[22:09:38] slerpnderp: sdegutis: i used homebrew to install libarchive, but can???t install the gem because of a missing archive.h ????????? the gem libarchive-static doesn???t install either
[22:10:00] pipework: slerpnderp: Have you linked it?
[22:10:18] sdegutis: slerpnderp: I am no expert sorry
[22:11:25] slerpnderp: pipework: how can i accomplisth that? ???brew link??? to what?
[22:11:39] slerpnderp: sdegutis: no worries, me neither
[22:12:00] pipework: slerpnderp: well, brew link would link all things
[22:14:13] sdegutis: time to work on an osx app for a bit while the kids play in an inflatable pool
[22:14:37] slerpnderp: pipework: i ran just ???brew link??? and was told i need a keg argument. then ran ???brew link libarchive??? and was told i need to link with the ???force??? option. does that sound like an ok idea?
[22:15:37] pipework: slerpnderp: sure, what's the worse that could happen?
[22:15:45] pipework: Also might want to start a new shell.
[22:16:18] jake1016: If I want to validate A < B but only if A and B exist, can that be done with NumericalityValidator or does it need to be a custom validator?
[22:17:42] pipework: jake1016: Use the if hash argument
[22:20:34] slerpnderp: pipework: worked like a non pipedream
[22:20:46] pipework: slerpnderp: sweet
[22:21:50] magg: I'm trying to do scope with joins, where and order. but so far active record is ignoring the join clause. the scope i'm doing is going to be inserted on a a has_many assoc (self join model)
[22:22:31] skullz: I should create an e-commerce system on Rails... should I go from zero or pick something ready to use?
[22:24:36] jake1016: pipework: Should this work: validates_numericality_of :min_age, less_than_or_equal_to: :max_age, if: max_age.present?
[22:24:49] salparadise: so trying to figure where rails pulls the sql user from, currently have something besides root in the database.yaml file, but it tries to use root, anyone have any hints on why it is using root and where to look?
[22:24:50] pipework: jake1016: You tell me
[22:25:11] jake1016: pipework: I???ll try it :)
[22:34:29] sdwrage: scope :slim, -> {where{(height.in(58...63)) & (weight.in(80...100)) | (height.in(63...68)) & (weight.in(100...120)) | (height.in(68...72)) & (weight.in(120...130)) | (height.in(72...78)) & (weight.in(130...150))}}
[22:36:24] sdwrage: whoops sorry
[22:43:48] amh345: what do you guys/girls use when you want to query / Xpath json?
[22:44:56] amh345: Im using JsonPath right now. but it's less than ideal.
[23:06:53] capin: salparadise: were you using root at one point?
[23:20:42] musegarden: hi everyone, I'm using paperclip and dropzone for file upload on a project, but when a user tries to upload a file on Windows (in any browser) they get redirected back to the upload page and there's no error thrown. Anyone know what could be causing this?
[23:21:09] axilaris: hi, how do i stringify an array ?
[23:21:57] scott0101: hey, anyone know how to skip the callbacks on heroku deploy to master?
[23:30:34] EasyCo: Hey guys, if you're wanting to nest route resources but don't want any routes on the parent resource what's the best approach?
[23:30:58] EasyCo: Instead of using except: [] and listing all the actions
[23:41:08] andrew9183: can you break out of a unless block
[23:42:32] capin: so many questions, don't know who to help :P
[23:53:10] jake1016: I???m trying to get a validation method without the attribute name prepended. I read an old SO post that said in rails 3.x, you could put a ^ in the begining of your message and it would drop the attribute name. This isn???t working for me in rails 4.1. Was this removed?
[23:53:19] jake1016: validation message, not method