« Back to channel list

#RubyOnRails - 11 November 2014

« Back 1 day Forward 1 day »
[00:00:13] bricker`work: Scriptonaut: you don't
[00:00:17] andll: Does anyone know what the potential error might be with the following eager loading syntax? Video.where(user_id: current_user.id).where(id: params[:id]).includes(:ratings).includes(:comments)
[00:02:22] Radar: Scriptonaut: code plzkthx
[00:03:38] Scriptonaut: Radar, I got it to work
[00:03:50] Radar: Scriptonaut: I still want to see it
[00:04:09] omosoj: if a route goes to /cats/5/dogs, what controller is invoked?
[00:06:07] Scriptonaut: <%= form_for @import, :url => { :controller => "people", :action => "import" }, :method => "POST", :class => 'form-horizontal', :multipart => true do |f| %>
[00:06:23] Scriptonaut: tell me if you want any other stuff
[00:07:43] karamazov: When making a call to an external REST API is the typical method just NET:HTTP? Or do most people use httparty?
[00:07:45] neredsenvy: Anyone familiar with https://github.com/taf2/curb how can you do a get on your own website ? Curl.get('/test/' + email); Gives malformed URL but providing the domain gives CORS error
[00:16:31] cleopatras: how i can log up my register user from irc
[00:16:48] cleopatras: cleopatra :Nickname is already in use
[00:17:04] siaW: i need help here
[00:17:05] siaW: https://eval.in/219753
[00:17:22] siaW: why do i get the argument error and how do i fix it?
[00:23:20] cleopatras: what is that method .attributes
[00:24:05] siaW: that???s what???s is used in the console to update an entry in the db
[00:24:07] siaW: i believe
[00:25:07] siaW: so the attributes are the labels ont he model
[00:26:03] Radar: Scriptonaut: It depends on what @import is
[00:26:16] Radar: Scriptonaut: I think your method is in the wrong spot. I think it should be :html => { :method => "POST" }
[00:26:34] cleopatras: I am a beginner too but i trink you need put that @parking.update(parking_params)
[00:27:13] siaW: cleopatras: nope
[00:28:25] MattB2: Radar: Topic: [...] Newest releases: 4.2.0.beta3 - beta4?
[00:29:42] cleopatras: let me understard you want to update multiple atributes on multiple models?
[00:32:21] bricker`work: siaw: two things
[00:32:27] bricker`work: siaw: .attributes is not what you think it is
[00:32:36] bricker`work: siaw: #update() takes arguments, you are not passing it arguments
[00:32:46] bricker`work: siaw: in other words, it takes 1 argument, you are passing it 0
[00:32:56] bricker`work: siaw: i.e. exactly what the error is telling you
[00:33:14] bricker`work: siaw: and once you fix that error, you'll have another error that #attributes() takes 0 arguments and you're passing it one
[00:33:22] rhizome: not to mention .update_attributes
[00:33:34] bricker`work: Either that or you'll get undefined method attributes for TrueClass, I forget what update() returns
[00:33:43] bricker`work: rhizome: that's probably the method he thought he was calling
[00:33:57] siaW: so i want to update at least one attribute
[00:34:05] bricker`work: siaw: update() takes a hash
[00:34:17] bricker`work: siaw: or a StrongParameters object
[00:34:25] Radar: Thanks MattB2
[00:34:49] siaW: so i could do like update(parking_params)
[00:35:35] MattB2: Radar: NP, would be good to have the chat log server in there too - when I join it's nice to be able to go and see what the current discussions are about, so handy link would be great!
[00:36:17] siaW: bricker`work: and also need to set @parking = Parking.find(params[:id]) in update method :D
[00:36:21] MattB2: Radar: Nice!
[00:37:40] siaW: bricker`work: thanks, it works! like magic!
[00:38:22] pragmatism: Test, can you all see me?
[00:38:36] bricker`work: pragmatism: yes
[00:38:44] pragmatism: bricker`work thanks.
[00:42:24] neredsenvy: Is there a easy way to have controller method return a JSON response instead of render a view ? Using NET::HTTP looks pretty messy
[00:42:56] bricker`work: neredsenvy: yes, there are several easy ways
[00:42:59] webdestroya: neredsenvy: render json: {some object}
[00:43:06] pragmatism: render block
[00:43:08] pragmatism: aaaaaannd I lose.
[00:43:32] bricker`work: neredsenvy: read this: http://guides.rubyonrails.org/layouts_and_rendering.html#using-render
[00:45:25] Scriptonaut: hmm, I don't seem to be able to save objects in my delayed job
[00:45:37] Scriptonaut: but for some reason it says it saved successfully
[00:45:49] pragmatism: You're going to have to provide a lot more information than that, haha
[00:45:52] Scriptonaut: like, I obj.save, it returns true, but the object isn't actually written to the db
[00:45:54] MattB2: neredsenvy: probably worth adding that when you want to get fancy, like restricting which fields get returned, there are lots of options. https://github.com/rails-api/active_model_serializers for example
[00:46:01] pragmatism: Did you reload the object?
[00:46:06] Scriptonaut: you gotta reload it/
[00:46:29] pragmatism: Or try save! so it fails noisily
[00:46:50] pragmatism: Depends on what you're doing.
[00:47:00] Scriptonaut: I dunno if I can do that, I overloaded save and made my own, then I call the old save with super
[00:47:03] Scriptonaut: I guess I could just rename it
[00:47:21] pragmatism: That sounds smelly, I might just rename it.
[00:48:14] MattB2: neredsenvy: I also just found this: http://reefpoints.dockyard.com/2014/05/27/avoid-rails-when-generating-json-responses-with-postgresql.html although while skimming I haven't grokked how it deals with authentication and authorization...
[00:48:16] Scriptonaut: pragmatism, sorry could you explain
[00:48:18] Scriptonaut: I'm pretty new to rails
[00:48:37] Scriptonaut: ah, rename my custom function, then just call self.save?
[00:48:41] Scriptonaut: from within it?
[00:48:46] pragmatism: Scriptonaut You overloaded save: that sounds bug-prone.
[00:49:00] neredsenvy: MattB2: Ty I'll look at it but it think webdestroya explanation will do the trick
[00:49:11] pragmatism: You can also ask an model instance if it's `valid?`
[00:49:51] Radar: [11:47:00] <Scriptonaut> I dunno if I can do that, I overloaded save and made my own, then I call the old save with super
[00:49:55] MattB2: neredsenvy: It's a performance optimisiation. If you don't need that, don't add the complexity.
[00:50:01] Radar: This would've been really fucking useful information to share first up
[00:50:14] Scriptonaut: btw this bug was happening before I did that
[00:50:20] Radar: Scriptonaut: Because we don't know what kind of bullshit you're doing in that save method
[00:50:52] neredsenvy: webdestroya: I wen't with your option however something keeps causing timeout on my request https://gist.github.com/anonymous/db062674037c6ea24dee
[00:51:21] webdestroya: neredsenvy: is that "something" the fact that your rest call might be timing out?
[00:51:26] neredsenvy: webdestroya: I have json response as you mentioned the call should return a response right awa
[00:51:57] neredsenvy: it is timing out
[00:52:11] webdestroya: also, why are you doing that? why are you having a REST call to something within the same app?
[00:52:30] siaW: i have a nested routes like this https://eval.in/219755 and in my index i have this https://eval.in/219756 how do i how do i write the link_to so that it takes me to place_rent of a particular parking model?
[00:52:43] neredsenvy: webdestroya: I'm just trying to test the url it will be calling an external url/api
[00:53:14] webdestroya: neredsenvy: yea, use webmock like pragmatism suggests. Also, your route does not match the URL you are calling
[00:53:51] karamazov: To make a wrapper or not make a wrapper for an external API...
[00:54:03] pragmatism: Wrap that shit like candy.
[00:54:17] webdestroya: karamazov: once you start copy/pasting logic to diff places, its time to wrap it
[00:54:35] Scriptonaut: hmm, so save! isn't complaining
[00:54:37] pragmatism: That way when the API changes, your implemnentation only has to change the in the wrapper class
[00:54:42] pragmatism: the rest of your app won;t have to care.
[00:54:53] karamazov: Cool - it's an external service that I need to make an API call too. I only have one use case right now but I predict others will arise.
[00:54:56] pragmatism: Scriptonaut is it .valid?
[00:55:13] pragmatism: karamazov Sounds like a perfect case for a wrapper class.
[00:55:30] karamazov: pragmatism: I don't know if I have enough redbull though.
[00:55:45] pragmatism: I usually recommend meth.
[00:55:58] karamazov: There is that sketchy bar downtown...
[00:56:11] pragmatism: Just look for the guy with the trackmarks. He knows.
[00:56:23] pragmatism: Tell him Prag sent you.
[00:57:03] MattB2: pragmatism: LOL!
[00:57:04] sevenseacat: pragmatism: you sound an awful lot like pipework.
[00:57:20] karamazov: Oh look a tdd tutorial on making an API wrapper....perfect and without the meth.
[00:57:38] Scriptonaut: pragmatism, yep valid
[00:58:06] pragmatism: sevenseacat great minds.
[00:58:13] Scriptonaut: I imagine if meth is anything like other amphetamines, it makes programming go about 10x as fast
[00:58:24] Scriptonaut: perfect drug for programming hands down
[00:58:36] pragmatism: Straight up.
[00:59:01] karamazov: Standing desk + meth? Profit.
[00:59:14] Scriptonaut: my office has a treadmill desk
[00:59:22] Scriptonaut: like a treadmill with a desktop set up on it
[00:59:40] Scriptonaut: every time I've seen someone on it, they're just standing with their feet to the side while the treadmill runs between their legs
[00:59:45] karamazov: I want to get an oculus rift and a laptop mount for my chest so I can turn around to look at different monitors.
[01:00:10] karamazov: Scriptonaut: That sounds like an injury waiting to happen.
[01:00:45] Scriptonaut: ya, I just imagine someone running, tripping, and ripping down the expensive computers, breaking them and getting tangled in chords
[01:00:47] MattB2: karamazov: link to API wrapper tutorial?
[01:01:00] sevenseacat: gives a whole new meaning to the term 'headdesk'
[01:01:03] karamazov: MattB2: http://code.tutsplus.com/tutorials/writing-an-api-wrapper-in-ruby-with-tdd--net-23875
[01:01:28] Scriptonaut: what the hell, this object is valid, why the hell won't it save correctly to my dv
[01:01:31] MattB2: karamazov: thanks
[01:01:56] pragmatism: Scriptonaut the logs know.
[01:01:57] sevenseacat: Scriptonaut: !reason
[01:01:59] karamazov: MattB2: Sure thing - I've just skimmed it but it looks like a decent tut
[01:02:17] MattB2: karamazov: and only 3 years old! ;-)
[01:02:41] baweaver: Curious, is it even possible to have real-time rails?
[01:03:02] karamazov: MattB2: I think the concepts can still provide useful.
[01:03:16] baweaver: Most of what I'm finding is a hot mess.
[01:03:42] Scriptonaut: where da logs at
[01:04:05] MattB2: karamazov: I know, just yanking your chain. :) I'm partway through wrapping the xbox music API, so always good to review best practices.
[01:04:06] Scriptonaut: mine doesn't have that
[01:04:09] pragmatism: Or, look at your rails server.
[01:04:18] pragmatism: Of course it does.,
[01:04:18] Scriptonaut: my app has: assets, controllers, helpers, mailers, models, and views
[01:04:35] Scriptonaut: prag, I've been looking at my rails server, no errors
[01:04:36] pragmatism: I didn't mean the actual /app
[01:04:39] Scriptonaut: though it does rollback I think
[01:04:43] pontiki: Rails.root
[01:04:50] pragmatism: that sounds like a validation failure or something.
[01:05:01] karamazov: Gotta go buy a six pack of redbull - cheers. Thanks pragmatism for the push to make the candy cane wrap/
[01:05:15] pragmatism: karamazov <3
[01:05:29] karamazov: I've been wanting to meet the aussies on here anyhow.
[01:05:52] Scriptonaut: pragmatism, you're an aussie?
[01:06:06] sevenseacat: only the cool kids can be aussies.
[01:06:09] karamazov: That was my way of stating I'll be up late.
[01:06:24] pragmatism: That went rrrrrright over my head.
[01:06:24] Scriptonaut: I got a house in Tasmania
[01:06:28] pragmatism: reddit joke bro
[01:06:30] karamazov: I'm on a different plane
[01:06:31] Scriptonaut: in St. Helens
[01:06:50] sevenseacat: ive been there, i think.
[01:06:58] pragmatism: sevenseacat are you Aussie?
[01:07:00] Scriptonaut: sevenseacat, you're an aussie?
[01:07:10] Scriptonaut: that's cool sevenseacat
[01:07:17] s2013: tasmania is beautifulo
[01:07:20] Scriptonaut: St. Helens, in the ring of fire on the east coast
[01:07:34] sevenseacat: hello from perth, australia.
[01:07:34] s2013: its primitive
[01:07:41] Scriptonaut: I loved Tasmania, I'm from a cold climate so it wasn't hot as bloody tits and I could stand it
[01:07:44] s2013: hello from texas, usa
[01:07:59] s2013: we have beautiful weather now here
[01:08:03] s2013: but i miss the cold
[01:08:07] Scriptonaut: Though I seriously was not a fan of all the poisonous shit
[01:08:17] Scriptonaut: every morning like 8 tiger snakes sunbathing in my drive way
[01:08:18] s2013: did you see any tasmanian devils
[01:08:19] pragmatism: Hello from s. California: it's been 80 all winter.
[01:08:22] Scriptonaut: giant fuckin spiders honestly the size of a dinner plate
[01:08:24] pragmatism: Fuck I wish it would rain.
[01:08:34] Scriptonaut: s2013, ya, 90% of them were dead on the side of the road though
[01:08:41] sevenseacat: yeah that happens a lot :(
[01:08:42] Scriptonaut: I don't think I've ever seen so much roadkill in my life
[01:08:49] s2013: ive seen bunch of dead wombats
[01:08:52] MattB2: pragmatism: and I was just about to comment on how all the cali''s clock off at 4pm ;-)
[01:08:52] Scriptonaut: like honestly just for miles, piles of them
[01:08:55] s2013: but no devilsin the wild or even dead
[01:09:00] s2013: but we did go to a sanctuary and i got to pet one
[01:09:11] pragmatism: 1620, to be exact ;)
[01:09:20] Scriptonaut: at a sanctuary, was cool, Wait, so s2013, you're from tasmania?
[01:09:26] s2013: im from the us
[01:09:32] s2013: but i lived in australia before
[01:09:32] MattB2: 1:09am here...
[01:09:34] Scriptonaut: ah, just visited? (I'm from the US too)
[01:09:44] s2013: i visited tasmania but i lived in sydney for a year
[01:09:51] pragmatism: MattB2 where are you connecting from?
[01:10:05] sevenseacat: somewhere in that timezone
[01:10:29] s2013: i do wanna go back to australia with a bit more money though
[01:10:29] MattB2: pragmatism: UK - hey just realized it's passed midnight - it's my B'Day!
[01:10:35] sevenseacat: as its 9.10am here
[01:10:37] pragmatism: Happy happy! Cheers man!
[01:10:40] s2013: happy birthday pragmatism
[01:10:58] pragmatism: s2013 its MattB2's bday
[01:11:03] Scriptonaut: the spiders are too big there
[01:11:09] s2013: yeah sorry i meant MattB2
[01:11:10] Scriptonaut: I think they were called huntsmen
[01:11:15] Scriptonaut: but honestly the side of a dinner plate
[01:11:17] s2013: yeah huntsman
[01:11:20] s2013: but i think they were friendly
[01:11:22] Scriptonaut: I have a picture of one I caught with a casserole dish
[01:11:33] Scriptonaut: they run so fast across the wall it just looks like a blur
[01:11:35] s2013: like they eat bugs and stuff.. luckily i didnt see any where i lived but my friends had some
[01:12:43] s2013: speaking of spiders, i had sleep paralysis few nights ago and i was dreaming i got caught in a room full of spider webs with gigantic spiders
[01:13:27] Scriptonaut: I had a dream my mom was about to shit her pants, and so was running up these stairs (spiral) in this building to get to a bathroom, and was so desperately running that she slipped off and fell down like 8 stories and died
[01:13:31] Scriptonaut: not making that up at all
[01:13:49] Scriptonaut: made me super sad when I woke up
[01:13:58] pragmatism: What the fuck
[01:14:04] s2013: :(i miss my mom..well ill see her for thanksgiving
[01:14:08] pragmatism: Can we talk about Rails instead?
[01:14:20] s2013: no pragmatism we are going to talk bout deaths and spiders
[01:14:29] MattB2: pragmatism: :)
[01:14:55] Scriptonaut: fine, you can, only cuz work is over
[01:15:00] Scriptonaut: I got whiskey to drink bye
[01:15:09] pragmatism: Share the wealth!
[01:15:32] s2013: speaking of rails, so i am really bad at testing cause i havent done much of it :\..
[01:15:59] pragmatism: Testing is both fun and essential
[01:16:11] frank_o: Hi! Anybody here among the lucky ones who've gotten to try out the new Raptor web server? Supposedly 4x faster than Unicorn, 2x faster than Puma! http://www.rubyraptor.org/
[01:16:17] pragmatism: I would start with unit tests, they're the easiest to write.
[01:16:24] s2013: yeah i can do basic testing stuff but not like crazy advanced stuff
[01:16:27] pragmatism: and start with Test::Unit, not RSpec.
[01:16:36] MattB2: pragmatism: good call
[01:16:39] s2013: ok im not THAT bad..
[01:16:46] s2013: but there are situations when i have no idea how to test it
[01:16:57] MattB2: s2013: like?
[01:17:03] pragmatism: That's why we're here!
[01:17:09] pragmatism: To mock you, and then help!
[01:17:33] s2013: so i need to write a test where if an admin updates a product, and the product already existed, one of its attributes wont change
[01:17:47] pragmatism: Are you using Devise?
[01:17:53] soahccc: I usually have the problem that my tests are essentially the code I test
[01:18:02] pragmatism: It has test helpers that'll let you "log in" as a user.
[01:18:43] s2013: actually sorry, the products photos wont change its attributes
[01:18:45] pragmatism: the rest should be pretty straight forward: login as the admin, assert the value, update the object, assert the value.
[01:19:03] s2013: so aphoto can be uploaded by an user or an admin
[01:19:09] pragmatism: soahccc testception
[01:19:15] s2013: if its uploaded by an admin it gets a flag that says added_by_admin
[01:19:43] s2013: if its by an user, then it doesnt.. however we had a bug that everytime the admin updated the product, the photo would get a added_by_admin flag set to true
[01:19:57] s2013: so i fixed that but i need to write a test for it
[01:20:59] soahccc: I find it much easier to write regression tests rather than "blind testing"... I guess I have the common testing problem: What to test and how
[01:21:34] s2013: im not surehow to really mock up the product and its photo properly
[01:21:39] s2013: we are using factory_girl
[01:22:09] pragmatism: s2013 Don't take this rudely, please, but did ypu read the docs?
[01:23:02] pragmatism: Factory girl's docs are really good.
[01:23:48] s2013: yeah... im going through them again. let me write some code and when it has issues ill paste it.
[01:24:28] frank_o: god damn this raptor looks awesome
[01:24:43] frank_o: cant wait till they release it in 14 days
[01:25:04] pragmatism: How are you going to get it off the island?
[01:25:27] pragmatism: Sorrry.... Jarassic park. I suck.
[01:25:37] pragmatism: Long Monday.
[01:25:49] frank_o: that was my fav movie back in the day ;)
[01:26:36] cleopatras: frank_o, -.-!
[01:29:02] frank_o: cleopatras! hey
[01:29:27] frank_o: thought you disappeared :)
[01:30:28] cleopatras: nah working hard behind the scenes
[01:31:53] cleopatras: I've been learning PlainJS And things of the "DOM"
[01:32:56] cleopatras: and what about you what news=?
[01:35:19] frank_o: hunting bugs 24/7 baby
[01:35:29] frank_o: seems for every bug i squash two new ones pop up, im going crazy
[01:36:21] frank_o: hopefully i can launch my app within 1-2 weeks. and within 1-2 months i can throw away my computer, travel to http://www.fourseasons.com/borabora/ and never come back
[01:38:21] cleopatras: but i can ask
[01:39:15] cleopatras: what drop down you use because i have look for some similar to that
[01:39:47] cleopatras: I've been trying to create my own icons with inkscape
[01:39:47] frank_o: for menu you mean?
[01:40:42] frank_o: i just use css, but i use https://github.com/briancherne/jquery-hoverIntent to make them more user-friendly. then for mobile i use https://github.com/jakiestfu/Snap.js
[01:41:25] frank_o: cleopatras: http://www.adobe.com/products/flash.html is the best icon drawing system i've ever come across
[01:42:47] cleopatras: me no like much jquery
[01:44:16] cleopatras: frank_o, i ill ask for that later
[01:45:13] frank_o: cleopatras: http://i.stack.imgur.com/sGhaO.gif
[01:48:15] cleopatras: the problem is that jquery overload the markup, so I've read is very slow loading websites
[01:48:41] cleopatras: but ijQuery is a great library
[01:49:10] frank_o: yeah i think you're right
[01:49:35] cleopatras: but I've been reading about it these last days see the book jQuery Succinctly
[01:50:04] frank_o: i dont know how you have time for all of this
[01:50:10] frank_o: u still working at the hospital right?
[01:50:38] cleopatras: anyway i will use jquery for my pre-beta then I will write everything in Plainjs
[01:50:55] cleopatras: yes frank_o in the morning
[01:51:19] cleopatras: 7 am to 13:00
[01:51:31] cleopatras: 7 am to 1 pm
[01:51:36] frank_o: that is so cool
[01:51:42] frank_o: must be the best job ever :)
[01:51:48] pragmatism: I xferred from medicine to engineering too!
[01:51:52] cleopatras: because i use my tablet for read on the hospital xD
[01:52:00] frank_o: ive tried to apply to hospital jobs myself.. but nobody wants frankie :(
[01:52:41] frank_o: pragmatism: why's that?
[01:52:46] cleopatras: that cool pragmatism
[01:52:50] frank_o: pragmatism: i hear that happens a lot
[01:53:06] pragmatism: I was a medic working as part of a trauma team in San Diego
[01:53:08] cleopatras: in this life we have to do everything
[01:53:24] pragmatism: Honestly, pay just wasn'ty good enough, and I decided I didn't want to do 12 more years of school.
[01:53:31] cleopatras: traumatology :S
[01:53:35] pragmatism: So, software!
[01:54:23] cleopatras: programmers earn 3 times the earnings of doctors here
[01:54:36] frank_o: pragmatism: if money wasnt an issue would you have stayed?
[01:54:46] frank_o: cleopatras: wow thats crazy !!
[01:54:58] frank_o: pragmatism: thanks for confirming that
[01:55:11] Brighton: has any1 seen this error when trying to add nested resources?
[01:55:12] Brighton: unknown attribute: article_id
[01:55:14] pontiki: proving yet again, anyone can write software :)
[01:55:20] pragmatism: I mean, on that same note, I fucking love writing software
[01:55:23] frank_o: pragmatism: set on entering med school myself but only if i have some app making money on the side so i dont have to worry about money
[01:55:35] frank_o: cant imagine being a doc going around transferring all my worries onto patients
[01:55:46] pragmatism: I majored in neuro at an Ivy, so it was a pretty rough xition at first lol
[01:55:55] cleopatras: if a doctor earnings 30$ per hour the programmer earnings 60-90$
[01:55:57] frank_o: holy.. neuro huh
[01:56:07] pragmatism: haha yeahhhhhhhhh
[01:56:17] pragmatism: It was a blast, but really not useful by itself.
[01:56:27] pragmatism: You're either going to grad school, med school, or starbucks.
[01:57:21] pragmatism: Plus I think one can do just as much for humanity through tech as through med.
[01:57:31] pragmatism: Which, really, is the point any way.
[01:57:47] pragmatism: peace, see you all manana
[01:57:49] frank_o: maybe even combine the two?
[01:57:54] pragmatism: One can hope!
[01:58:00] frank_o: wait hold up i found this really cool infographic once
[01:58:33] cleopatras: I'm in an attempt at covering the basics ruby , js ,css c++
[01:59:12] cleopatras: when my site is ready and running quite successfully bye hospital
[01:59:28] pontiki: big dreams!
[01:59:34] pontiki: hope they come true
[01:59:47] frank_o: pragmatism: some other time, cant find it right now, but it was a med+tech dream come true
[02:00:16] frank_o: pontiki: yeah she'll make it
[02:00:44] frank_o: plus she has our support so..
[02:01:29] cleopatras: gracias frank_o :)
[02:01:44] frank_o: pragmatism: for what its worth: http://scienceroll.files.wordpress.com/2013/10/medical_infographic_final.jpg
[02:02:07] frank_o: cc cleopatras
[02:03:12] cleopatras: I'm sure i realize pontiki I just need time and great effort
[02:05:53] cleopatras: hey frank_o you site is write in rails?
[02:24:14] ayesian: is there a way to have 2 compiled sets of javascript for use in the javascript include tags
[02:25:07] ayesian: 2 compiled sets, 1) ABCDE, 2) BCE
[02:36:07] karamazov: I'm looking at a tutorial that uses setup { host! 'api.example.com' } in their integration tests. Periodically, I like to look up methods in the docs and can't find anything about host!
[02:36:38] karamazov: is host! an Rspec thing?
[02:36:40] enitiz: cleopatras, how many years of experience do you have?
[02:37:25] cleopatras: few months why
[02:38:09] enitiz: well.. i'm trying to do something like you
[02:39:28] enitiz: idk but now i feel like i should try to do everything but just be good at one of these html/js/rails or ruby thingy
[02:41:43] cleopatras: Well I try a long time, do everything together and fail
[02:42:27] cleopatras: first you must go step by step
[02:43:11] rshetty: https://gist.github.com/rShetty/03e0693ef41544360de3
[02:43:24] cleopatras: if you like the markup start learning HTML, css JavaScript
[02:43:28] rshetty: I am using composed_of in rails with Money Value object class
[02:43:42] rshetty: I am facing the problem mentioned in the gist above
[02:44:35] helpa: rshetty: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[02:44:35] sevenseacat: rshetty: !debug
[02:45:17] sevenseacat: your mapping is almost certainly wrong though, as is your attr_reader line
[02:46:13] rshetty: sevenseacat: Fixed the attr reader line in gist
[02:46:20] rshetty: What is the problem in mapping ?
[02:47:22] sevenseacat: rshetty: lets start with the error youre getting
[02:47:43] sevenseacat: and how you're getting it
[02:47:55] omosoj: model1 belongs_to model2. how do i query model2 to get information from model1? Model2.find(id).field_name?
[02:48:03] helpa: omosoj: Please do not use fake values, as they can be confusing or misleading. Sometimes both.
[02:48:03] sevenseacat: omosoj: !fake
[02:48:48] omosoj: Sale belongs_to Product. ^^ Product.find(id).markdown doesn't work... :/
[02:48:50] rshetty: ok, There is a amount field in db, and the amount is an integer field to store the money in cents and there is a reference to currency model, so the db has currency_id
[02:49:10] rshetty: When a request is sent to create the model object, I am getting NoMethodError: undefined method `value' for 80:Fixnum
[02:49:21] rshetty: so 80 is being sent as a amount field
[02:49:21] sevenseacat: rshetty: no. gist the code that you're running that gives you the error.
[02:49:40] sevenseacat: with the backtrace of the error
[02:51:24] rshetty: updated the gist
[03:01:27] rshetty: sevenseacat: Updated gist
[03:03:31] Akuma: hello, is it possible to specify a migration t.belongs_to :table as something other than table_id?
[03:05:08] Akuma: how can I achieve that?
[03:07:54] jimbo3918: unicorn power
[03:08:13] jimbo3918: Akuma: code example will be nice
[03:09:49] Akuma: I want to create a table that references to itself through a "t.belongs :table" but I don't want the result to be table id; for example "t.belongs_to :mytable, :as => :my_special_field"
[03:10:25] cleopatras: some similar to join table?
[03:11:56] Akuma: here is my migration: http://pastebin.com/ExXnaiCP
[03:12:15] jimbo3918: Akuma: If you show us the code you're talking about we can see more information about, the context and other stuff that can help us to help you
[03:12:24] jimbo3918: Akuma: Use gist please
[03:12:49] Akuma: http://pastie.org/9710847
[03:13:40] cleopatras: curious that is making a association to the same table
[03:14:50] jimbo3918: Akuma: I'm not 100% sure but you can't do that. Why?
[03:15:05] jimbo3918: Akuma: making a association to the same table
[03:15:07] Akuma: because I need some plans to refer to parent plans
[03:16:54] jimbo3918: Akuma: A NoSQL databse work like this (parent,children and so on) but not a relational database
[03:17:53] Akuma: I'll try to work another way, thanks for the help
[03:18:35] jimbo3918: Akuma: Yes this is the good way to think about it. yw!
[03:18:56] axilaris: hi, anyone can help whats wrong with my activerecords date problem https://gist.github.com/anonymous/684660166b6cd2bc87ab
[03:19:28] cleopatras: Akuma, I think you can do it through methods as a categorization
[03:22:08] cleopatras: Akuma, belongs_to :parent, :class_name => 'Plans', :foreign_key => 'plans_id'
[03:29:22] cleopatras: Akuma, i have forget
[03:30:39] cleopatras: Akuma, This chunk of code helped me make a related categorization https://gist.github.com/ArpiaPsuv/2f10b0ce8f7fbfe0cd1a
[03:33:09] cleopatras: root@cleopatra:~# rails -v
[03:33:09] cleopatras: Rails 4.2.0.beta4
[03:33:27] Radar: axilaris: Your dates are strings, when they should be Date objects.
[03:45:23] Akuma: cleopatras: thanks, I'll take a look at it
[04:15:43] rshetty: Hey can anyone help with the composed_of problem ?
[04:15:51] rshetty: Here is the gist with the problem https://gist.github.com/rShetty/03e0693ef41544360de3
[04:23:48] cleopatras: rshetty, i am no expert
[04:24:46] cleopatras: rshetty, but you do not have any method called "value"
[04:25:52] rshetty: cleopatras: It is calling value on a fixnum, which it should call on a Money object
[04:26:22] rshetty: I am missing something in composed_of implementation, which I am unable to figure out
[04:26:39] rshetty: If someone can give me an example of its usage it would helpful
[04:50:15] cubb: how do I get these list items to output on separate lines? https://gist.github.com/cubb/886148da84ac9b27cb75
[04:53:36] hassanshaikley: hi guys can anyone take a look at this...
[04:53:37] hassanshaikley: https://gist.github.com/hassanshaikley/48271db5a0d44e6fe536
[04:54:14] hassanshaikley: assert shop_on.valid? is what fails
[04:54:51] soahccc: " I hack together my own CFCs and frameworks according to my own level of standards." Anyone know what CFC stands for?
[05:00:43] smathy: hassanshaikley, run the same `shop = Shop.new` and `shop.valid?` code in your rails console, and then run: y shop.errors.messages
[05:02:28] hassanshaikley: I jsut had to save : (
[05:02:32] hassanshaikley: or else the foreign key didn't work
[05:02:39] hassanshaikley: ty ;D !!!! smathy
[05:02:45] smathy: You're welcome :)
[05:05:00] smathy: soahccc, the internet says it's a ColdFusion component.
[05:06:53] sevenseacat: the internet is always right.
[05:06:56] smathy: cubb, what's `endfor` and `endif` ?
[05:06:56] soahccc: smathy: hmm makes sense now :)
[05:07:11] smathy: soahccc, yay internet!
[05:09:54] karamazov: Hey - If I'm making a wrapper for an API...all the specs should go in the gem right? As opposed to testing it via the app.
[05:09:56] smathy: rshetty, you've read through http://api.rubyonrails.org/classes/ActiveRecord/Aggregations/ClassMethods.html ?
[05:10:09] cubb: smathy jekyll stuff, but I assumed it was ERB stuff like RoR
[05:10:29] cubb: and yes, I did ask on #jekyll, but it's a ghost town there
[05:11:11] s2013: wtf... i have this weird thing.. for some reason all data from my mysql db keeps disappearing.. the tables are there but no data
[05:11:17] s2013: anyone had something similar
[05:11:28] smathy: cubb, ghost town here for jekyll help :) Sorry, never played with it to that level.
[05:11:35] sevenseacat: s2013: are you truncating them in tests or something?
[05:12:00] smathy: s2013, test environment set to the wrong DB?
[05:12:02] cubb: smathy, is it not ERB?
[05:12:11] s2013: whwat do you mean? it happened once this morning when i switched from using unicorn to webrick
[05:12:28] smathy: cubb, ERB doesn't have any special statements, it's just ruby - which `endfor` and `endif` are not.
[05:12:32] s2013: and now i was running a test.. but i went into rails console, and same thing.. its in development environment
[05:12:38] s2013: also i went into the mysql db itself and it was empty
[05:12:45] s2013: i had to reload data into it.. so odd
[05:12:45] sevenseacat: s2013: is your test database sharing your development database?
[05:12:59] cubb: smathy: oh shoot, maybe jekyll is liquid templating
[05:13:04] s2013: maybe, let me chekc
[05:13:08] smathy: s2013, I mean if the test section of your database.yml file is pointing at this DB that has been blanked out.
[05:13:33] smathy: cubb, those delimiters too aren't (standard) ERB, erb's are <% %>
[05:13:35] s2013: so it clears out the entire db?
[05:13:44] sevenseacat: if you configured your tests to do so
[05:13:50] smathy: By default, yes.
[05:13:52] s2013: ok i wonder why it happened earlier before i ran the tests
[05:14:01] s2013: oh well, atleast now i know
[05:14:33] smathy: I've done it a few times too :)
[05:14:59] s2013: for running tests. do you need to create the db and have all the tables ahead of time or does it automatically do that
[05:15:53] sevenseacat: depends on the version of rails you'reusing.
[05:16:18] s2013: gotcha, well one way to find out
[05:18:29] Varun_krishna: sevenseacat: Good morning :)
[05:18:37] sevenseacat: varun_krishna: hello.
[05:19:00] Varun_krishna: sevenseacat: So what is the best way to become better with RoR ?
[05:19:06] s2013: ok i had to create the db.. and i guess i need to do the tables as well
[05:19:06] sevenseacat: varun_krishna: by using it. a lot.
[05:19:12] s2013: varun_krishna, its to bug sevenseacat forever
[05:19:26] Varun_krishna: s2013: ha ha ha , :)
[05:19:29] sevenseacat: no, it's really not.
[05:19:41] s2013: ha ha ha yes it is
[05:20:06] sevenseacat: we can fix that
[05:22:12] s2013: ok so i had to create db and run migrations on the test db to get tests to run. awesome
[05:22:23] Varun_krishna: sevenseacat: Yes, the the day when I'd started RoR, it was like a nightmare for me but now I am little bit comfortable with RoR. :)
[05:22:42] sevenseacat: s2013: or you could have used the built-in tools Rails has for that
[05:22:54] s2013: which one?
[05:22:54] nahtnam: Hey! If I have HTML files that I need to include, do I put them in the public folder, or can I put then in the vendor folder?
[05:23:08] sevenseacat: s2013: when you answer the question about the version of rails you're using, i can tell you.
[05:23:17] s2013: this one is 3.2
[05:23:24] sevenseacat: then you use rake db:test:prepare
[05:23:41] s2013: oh.. i just ran rake db:migrate RAILS_ENV=test
[05:24:26] smathy: nahtnam, public
[05:24:51] s2013: do you wear glasses sevenseacat ? or anyone else
[05:24:53] nahtnam: smathy: Ok, thanks
[05:24:53] sevenseacat: how exactly do you 'include' html files?
[05:24:59] sevenseacat: s2013: i do, yes.
[05:25:06] s2013: and do you take them off while working?
[05:25:07] smathy: I assumed "include in my project"
[05:25:22] sevenseacat: s2013: no. i would get even worse migraines if i did
[05:25:48] s2013: o. i am near sighted so i usually work with my glasses off.. anyways, just wondering what others do
[05:25:56] ayesian: in <= f.input id: "phonenumber" %>????????????. it comes out as <input id=phonenumber>???.. how to have with " " quotes? so it's <input id="phonenumber">
[05:26:23] ayesian: i tried <% f.input "#{ "phonenumber"}" %>, does not work
[05:26:58] sevenseacat: it doesnt come out without quotes.
[05:27:58] sevenseacat: s2013: well not everyone who wears glasses is nearsighted
[05:29:22] ayesian: sevenseacat: it only come out in double quotes if i put a space in it
[05:29:33] sevenseacat: ayesian: show me the generated html.
[05:29:42] sevenseacat: its not valid with a space in it.
[05:30:51] smathy: ayesian, which version of Rails too?
[05:31:24] ayesian: <input class=hidden id=phonenumber name=
[05:31:35] ayesian: latest rails 4.1.7
[05:31:46] sevenseacat: that isnt generated from that ruby snippet
[05:32:30] ayesian: this is from the html output view source
[05:32:37] Varun_krishna: sevenseacat: What is the proper naming convention for table names inside a migration file ?
[05:32:47] smathy: ayesian, sorry, which form library, simple_form? Which version?
[05:33:32] sevenseacat: varun_krishna: http://guides.rubyonrails.org/migrations.html
[05:33:58] Varun_krishna: sevenseacat: Yeah thanks.
[05:34:27] tmoore: ayesian: maybe https://github.com/plataformatec/simple_form#html-5-notice
[05:36:47] ayesian: actually let me change my question since this channel is active tonight
[05:36:55] Varun_krishna: sevenseacat: what is wrong with this change_column (:members, :mobile, :string, :null => ture) . Why am I getting errrors ?
[05:37:10] ayesian: <%= f.input :image, as: :hidden, class: "canvascontent" %>
[05:37:20] sevenseacat: varun_krishna: depends on what the errors are
[05:37:26] sevenseacat: you misspelt true, for starters
[05:37:55] ayesian: ???. loads image file into canvas???. var url = reader.readAsDataURL(file);???????????????$(".canvascontent").val(url);
[05:38:28] ayesian: how to make that work? basically, choose file, it goes into canvas, then insert canvas data into hidden form field
[05:38:37] Varun_krishna: sevenseacat: even after changing ture to true, netbeans says unexpected ','
[05:38:55] helpa: varun_krishna: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[05:38:55] sevenseacat: varun_krishna: !debug
[05:39:19] Varun_krishna: sevenseacat: this is the only message I got from netbeans.
[05:39:26] sevenseacat: i dont give a crap about netbeans
[05:39:33] sevenseacat: netbeans is irrelevant to me
[05:39:40] tmoore: varun_krishna: you have a space between change_column and (
[05:39:57] ayesian: i've spent days on this??? no dice, anybody have ideas?
[05:40:06] sevenseacat: ah i didnt see that.... irc is not a good medium for sharing code
[05:40:13] Varun_krishna: tmoore: Yeah, just now fixed that.
[05:40:22] sevenseacat: hence we ask for gists
[05:40:41] Radar: rly helpa?!
[05:40:59] sevenseacat: he has lots of different variations of his nick
[05:41:00] Radar: !siunce Varun_krishna
[05:41:07] Radar: varun_krishna: 204 days
[05:41:07] tmoore: ayesian: what is not working?
[05:41:10] Radar: varun_krishna: You should know the rules by now.
[05:41:17] Radar: varun_krishna: Please put all code in Gists.
[05:41:33] ayesian: loads image file into canvas???. var url = reader.readAsDataURL(file);???????????????$(".canvascontent").val(url);
[05:41:42] ayesian: <%= f.input :image, as: :hidden, class: "canvascontent" %>
[05:41:44] ayesian: form submit
[05:41:57] Varun_krishna: Radar: Yes, but I had some stupid space between change_column and ( this thing. Sorry for causing trouble. :) to you and sevenseacat .
[05:42:20] Radar: varun_krishna: Which would've been noticed if it was gisted. So please gist code.
[05:43:07] tmoore: ayesian: I saw what you posted, but you haven't said what the problem is
[05:43:09] Varun_krishna: Radar: Yes, fixed it, thanks. I first joined this channel 204 days abo, but I am actively doing RoR since this July :)
[05:43:17] ayesian: tmoore: it does not work!
[05:43:25] s2013: https://gist.github.com/ss2k/6ad2f3bce7d04856a8f6 how do i pass the plant attributes thats generated from factory_girl
[05:43:44] s2013: otherwise params[:plant] is empty
[05:43:48] smathy: varun_krishna, you have a space between the method and open paren.
[05:44:04] ayesian: on form submit, the params shows that it's blank for the hidden field
[05:44:20] smathy: ayesian, extra hidden ;)
[05:44:26] Varun_krishna: smathy: yeah, noticed that one, thanks mate :)
[05:44:58] smathy: varun_krishna, you know that's invalid ruby right? I was genuinely offering a suggestion for your issue.
[05:45:05] smathy: ayesian, just messin'
[05:45:25] smathy: You said the channel was active, but you didn't say anything about it being constructive ;)
[05:45:43] tmoore: ayesian: can you gist all of the code?
[05:46:19] Varun_krishna: smathy: NO, Just now I'd learnt that space between the method and () is invalid in ruby :)
[05:46:35] smathy: varun_krishna, did that fix NetBeans?
[05:47:08] Varun_krishna: smathy: That has noting to do with netbeans issue, it was that extra space caused error in the migration :)
[05:47:27] Varun_krishna: smathy: Yes now I ran the migration.
[05:51:50] ayesian: tmoore: https://gist.github.com/ayesian/378c3e17008da281bca1
[05:55:29] ayesian: spent 5 days on this, no dice
[05:56:44] ayesian: im trying to get client side resizing to work.. originally: user click choose file, resize on client side, and upload resized file
[05:57:38] smathy: FMD, Radar, where's that gist or post or whatever about how to create a gist?
[05:57:41] ayesian: now: user clicks choose file, file is drawn on canvas to preview (resized smaller), insert canvas image into hidden image data field on form, and post form
[05:57:46] helpa: smathy: How to use Gist properly: https://github.com/radar/guides/blob/master/using-gist.markdown
[05:57:46] Radar: smathy: !gist-usage
[05:57:54] smathy: ayesian, ^^
[05:58:03] smathy: Please, help us help you, help US help YOU.
[05:59:18] ayesian: this is client side there should be no other file
[06:07:40] tmoore: ayesian: this is pretty off topic for the channel, but you're using the FileReader API incorrectly https://developer.mozilla.org/en-US/docs/Web/API/FileReader.readAsDataURL
[06:07:44] tmoore: it's asynchronous
[06:08:03] tmoore: it doesn't return the URL
[06:09:35] tmoore: you need to set the hidden field in the fileOnload handler
[06:10:44] tmoore: ayesian: but what you described about it taking the canvas image to use in the form... there's no code in your gist that does this
[06:13:17] ayesian: tmoore: any ideas how to do that?
[06:17:29] tmoore: ayesian: not really... I'd start by looking up the canvas API
[06:21:00] ayesian: well that didn't work else it would not be day 5
[06:21:29] sevenseacat: so what have you been doing for five days, just asking people?
[06:22:54] ayesian: sevenseacat: looking at docs, asked twice, didn't help
[06:23:46] s2013: if your controller is expecting a nested attribute.. like params[:plant][:photo_1] how do you pass the nested attribute in rspec
[06:24:12] sevenseacat: you define the nested hash, then pass it to the spec
[06:29:19] s2013: yay my test finally passes
[07:21:57] jacksparrow007: How can I find the difference between a Date and ActiveSupport::TimeWithZone ?
[07:30:03] shortCircuit__: where do I put my load_and_authorize_resource for active admin?
[07:30:54] karamazov: I'm attempting to TDD a API wrapper gem using HTTPparty. So far, I've got it must include HTTParty and it should have a base uri of "http://myexample.com"
[07:31:12] karamazov: I don't know what the spec should look like for the basic auth.
[07:32:41] shortCircuit__: I think you can set the date without timezone and then travel two three latitudes or longituted 144 km approx and say "whoaa it doesn't work without timezone." :D
[07:48:18] adac: I get 'unauthorized' for every controller action I call, even though I do not use a before_action authentication directly on some of the controllers. This happend since an uprade from Rails 3 to Rails 4. I checkd if my app has somehow setup a global thingy for the authentication, but I think this is not the case. Does anyone know if something devise/rails does things has changed from rails 3 to rails 4 that could cause this problem?
[07:49:03] shortCircuit__: http://pastie.org/9711121 I have this ability, now whenever i try to login an user in AA who has a staff role I get a redirect loop in browser
[07:49:34] sevenseacat: shortCircuit__: probably because they dont have permission to access the page you're trying to redirect them to
[07:50:00] sevenseacat: or the page your unauthorized exception is trying to redirect them to
[07:50:43] shortCircuit__: is it how foolish of me, I forgot to write can :manage , AdminUser and that's why they get access.
[07:50:52] shortCircuit__: (ignore the how)
[07:55:33] shortCircuit__: I wrote can :manage, AdminUser and the admin page itself doesnot load.
[08:01:57] Varun_krishna: Hi guys I am using mailcatcher for my development machine, so I am trying to send emails when the user clicks the request number button on the show page, but I could not find anything in mail catcher here is my gist https://gist.github.com/Varun-Krishna-P/53f685833b73cc4ecd0c
[08:03:50] tbuehlmann: Varun_Krishna, what rails version are you using?
[08:04:57] Varun_krishna: tbuehlmann: Just a minute Rails 3.2.19
[08:06:15] tbuehlmann: I'd have suggested using ActionMailer::Preview, but that's rails >= 4.1. so: no idea
[08:10:12] sevenseacat: Varun_Krishna: you're not delivering the email.
[08:10:56] Varun_krishna: sevenseacat: Yes, just now I was going throught the rails guide and found out that I am missing that .deliver,
[08:12:07] Varun_krishna: sevenseacat: Thanks for pointing it out. How did you know that I am missing deliver, when I don't know that one ?
[08:12:18] sevenseacat: Varun_Krishna: because i looked at your code.
[08:12:50] Varun_krishna: sevenseacat: plus, you have practice with rails am I correct ?
[08:16:34] Varun_krishna: sevenseacat: even though I am not seeing anymails in mail catcher .
[08:16:55] sevenseacat: did you configure your app to use mailcatcher?
[08:17:18] Varun_krishna: Configuration ?
[08:17:26] sevenseacat: yes. read the mailcatcher docs.
[08:17:54] Varun_krishna: Yeah I will check that,
[08:18:10] Varun_krishna: is there anything to do with the routes verb?
[08:18:47] Varun_krishna: like post get ?
[08:18:58] sevenseacat: what does that have to do with sending email?
[08:19:19] Varun_krishna: no I just asked it .
[08:20:24] SteenJobs: feels like i haven???t been here in a while
[08:20:28] shortCircuit__: SteenJobs , haaaiii
[08:20:33] sevenseacat: SteenJobs: hello.
[08:20:46] SteenJobs: o hello everyone. hope you didn???t miss me too much.
[08:21:15] shortCircuit__: but I was trying to.
[08:21:22] SteenJobs: thankfully i haven???t run into too many issues over the past few days
[08:21:35] SteenJobs: haha yea good stuff
[08:21:51] SteenJobs: although i have a minor issue i just ran into - no method search defined for my Post model
[08:22:06] SteenJobs: i???m wondering if that just means i need to create and index for my posts table
[08:22:14] shortCircuit__: you don't have a method.
[08:22:27] shortCircuit__: maybe like @post.firstname
[08:22:54] SteenJobs: whoops. put the method in the wrong model haha
[08:23:02] SteenJobs: guess i didn???t really need to show tonight in the end
[08:23:17] shortCircuit__: where firstname is def firstname @user.firstname end and you don't have this.
[08:23:41] shortCircuit__: Its good to say hi to frands sometimes.
[08:23:52] SteenJobs: yea, it???s fixed. just moved the method.
[08:24:20] sevenseacat: you can hang around without havign a specific question you know
[08:24:59] SteenJobs: and that???s what i did for a while! but then i got to a point where i was depending too much on you guys always knowing the answer (except for mysterious dropdown menus), and focused less on problem solving myself.
[08:25:21] SteenJobs: then again, trying to solve other people???s questions is excellent practice.
[08:25:24] sevenseacat: did you end up getting those dropdowns fixed?
[08:25:30] shortCircuit__: I never solved a problem myself. :((( google does that for me :(
[08:25:50] SteenJobs: ahh shortCircuit__ , error messages are your friend, not your enemy.
[08:25:55] SteenJobs: sevenseacat taught me that one.
[08:26:06] DarkCthulhu: I have a table pkeywords => (keyword_id, user_id), keywords => (keyword_id, keyword) and users (user_id, user_name). What kind of relationship should I setup sich that I can query with a keyword, and get all user_names for whom that keyword exists?
[08:26:24] SteenJobs: sevenseacat: no, but my friend and i redid the front-end work using a template and now that the dropdowns are running on js it seems to be working fine.
[08:26:30] shortCircuit__: I know. I always feel there is something wrong with git push when i don't have a conflict :P
[08:26:32] Varun_krishna: sevenseacat: Yes I ahve added this config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 } in my development.rb
[08:26:36] DarkCthulhu: I know the join syntax, but the has_many, belongs_to thing is a little confusing.
[08:26:52] SteenJobs: sevenseacat: but then again, i haven???t merged the branch for the main app with the admin-interface, so it might resurface. i???ll be sure to keep you posted :)
[08:28:14] SteenJobs: sevenseacat: on the blog page, i have a few instance variables defined in the blogs controller for the widgets like ???recent posts???. if i???m creating a posts index page to display search queries, using the same html as the blog page, is there a shorter way to display the widgets without just copying the same variables into my posts controller?
[08:28:24] SteenJobs: sevenseacat: i???ll gist it if that doesn???t make sense. i know it???s detailed.
[08:28:58] SteenJobs: sevenseacat: i presume not. i???m just trying to keep my controllers neat.
[08:29:11] sevenseacat: well reusing a view is a bit different than copying a controller variable definition
[08:30:38] SteenJobs: sevenseacat: right, i thought so. only because i have things like @popular_tags, which i need for the widget to display properly.
[08:30:58] SteenJobs: it???s not a big deal, i just defined them in the posts controller index action again. doesn???t add a lot.
[08:31:28] SteenJobs: sevenseacat: the app is really coming together. want to finish it already so i can show you.
[08:31:32] sevenseacat: if rails was true mvc, you'd have a controller just for that widget with the variables and all would be well
[08:31:40] sevenseacat: but alas, it is not.
[08:32:06] SteenJobs: oo that???s actually really interesting.
[08:33:39] mauro1254: curl -H "Content-Type: */*" http://www.example.com
[08:34:04] mauro1254: Is it correct that with the command above the first instruction in the respond_to block is evaluated?
[08:34:23] Varun_krishna: sevenseacat: is there a way to check whether the mail catcher is working?
[08:34:32] sevenseacat: Varun_Krishna: send an email to it.
[08:35:05] sevenseacat: Varun_Krishna: you might want to turn delivery errors on in your development.rb.
[08:35:17] mauro1254: sevenseacat: what do you think?
[08:35:32] sevenseacat: mauro1254: i think it would be really easy for you to test out and find the answer.
[08:35:53] Varun_krishna: a week ago it worked, but now I try send emails , it is not working. Shall I gisst my development.rb?
[08:36:01] sevenseacat: Varun_Krishna: no.
[08:36:14] mauro1254: sevenseacat: tested and seems to be as described, but then ... In examples I often see format.any at the end of the block
[08:36:22] sevenseacat: gist any relevant errors or logs
[08:36:34] sevenseacat: mauro1254: that would be for if the requested format doesnt match any of the previous blocks
[08:36:43] mauro1254: Ah ... okk ...
[08:37:13] mauro1254: */* is satisfied by the first one ... I had format.js as the first one
[08:37:35] mauro1254: And that gave me a ActionController::InvalidCrossOriginRequest
[08:38:14] kevinem: guys...can someone help me?
[08:38:43] sevenseacat: kevinem: they make creams for that.
[08:39:07] kevinem: a project using has_and_belongs_to_many_with_deferred_save
[08:39:11] pragmatism: kevinem Gather your data and gist it with your suspicious source.
[08:39:14] kevinem: creating problem
[08:39:38] pragmatism: sevenseacat noobs don't get the humor
[08:40:12] shortCircuit__: I think I get the error, the admin_user ||= AdminUser.new, so when the page isn't loaded yet so maybe.
[08:40:33] pragmatism: kevinem please try to summarize your question and source in to a gist (google it) so we can help evaluate it.
[08:40:48] pragmatism: sevenseacat haha yeah :/
[08:40:57] kevinem: https://gist.github.com/070c52c764a2adf4441b.git
[08:41:29] sevenseacat: what on earth is _with_deferred_save
[08:41:37] kevinem: it's a gem
[08:41:42] pragmatism: kevinem I need you to actually provide the source code in question.
[08:41:58] shortCircuit__: what does it mean to make cream
[08:42:01] pragmatism: kevinem with any logging you may also have.
[08:42:09] sevenseacat: a many many year old plugin by the looks of it
[08:42:19] sevenseacat: that is likely not compatible with anything even remotely recent
[08:42:32] pragmatism: kevinem Can you refactor your code to not use that library?
[08:42:48] shortCircuit__: deferred sounds Promise-ing
[08:42:54] sevenseacat: last update february 2010
[08:43:11] shortCircuit__: a leap year ago. \o/
[08:43:16] kevinem: pragmatism: i'll have to try that...because i don't know what it does right now
[08:43:18] pragmatism: kevinem take a look at delayed job
[08:43:31] kevinem: pragmatism: okay!
[08:43:35] pragmatism: see if that fulfills your needs.
[08:43:40] Radar: kevinem: when showing errors like that please include stacktraces as well as the error itself
[08:43:52] pragmatism: Otherwise, PM we can take a closer look.
[08:44:03] pragmatism: Radar kevinem +1
[08:44:04] sevenseacat: what does deferred saving have to do with delayed job...
[08:44:44] Varun_krishna: sevenseacat: here is the gist https://gist.github.com/Varun-Krishna-P/8806d4de8698b969254c
[08:44:45] pragmatism: Event Machine
[08:45:03] pragmatism: I figured he was act modelling
[08:45:04] kevinem: Radar, pragmatism: a full copy paste of the error page will do?
[08:45:48] pragmatism: so it was either DJ or Cell
[08:45:59] sevenseacat: Varun_Krishna: did you enable raising delivery errors?
[08:46:01] sevenseacat: like i told you to
[08:46:14] pragmatism: Buuut yeah, defer t or f is EM
[08:46:21] Varun_krishna: by default is it false or true ?
[08:46:41] sevenseacat: in development, false.
[08:46:45] Varun_krishna: sevenseacat: config.action_mailer.raise_delivery_errors = false
[08:46:50] Varun_krishna: YEs I have it.
[08:46:52] pragmatism: kevinem Read the output, and isolate the exception method.
[08:46:58] Varun_krishna: let me try with another user
[08:46:58] pragmatism: kevinem Read the output, and isolate the exception text.
[08:47:08] sevenseacat: Varun_Krishna:now actually enable it like i've said three times now.
[08:47:10] pragmatism: Fuck, this isn't Slack
[08:48:19] pragmatism: the opposing boolean to false is true.
[08:48:42] pragmatism: There are only two possible vlaues.
[08:49:02] pragmatism: hence "boolnea"
[08:49:23] pragmatism: I'm out, too tired.
[08:49:31] Varun_krishna: pragmatism: at last typed it correctly :)
[08:50:58] Varun_krishna: sevenseacat: is it necessary to restart the rails server after changing deployment.rb ?
[08:51:15] siaW: my schema looks like this http://gyazo.com/e3fc35653c99986a49d7e70c09c59be8
[08:51:25] kevinem: pragmatism: please check if this is okay, https://gist.github.com/f9e06da6603102356ae0.git
[08:51:34] siaW: how do i get the first name of the person who own one car in console?
[08:51:43] Varun_krishna: sevenseacat: Ok , could you please give me some time, I will go out for lunch and come back soon . ?
[08:51:50] kevinem: pragmatism: please check if this is okay, https://gist.github.com/kevin-madhu/f9e06da6603102356ae0
[08:52:14] nrsk: Hi all! I am testing mailing with Mail::Matchers, can't find how to test attachments?
[08:52:33] siaW: c.person.find_by (owner_id: 1).first_name
[08:52:36] siaW: and it???s not working
[08:53:22] Varun_krishna: sevenseacat: I get this An SMTP To address is required to send a message. Set the message smtp_envelope_to, to, cc, or bcc address.
[08:53:42] sevenseacat: hey there we go, you cant send a message without a recipient address.
[08:54:06] shortCircuit__: https://gist.github.com/argentum47/31462b83e95e708e5260#file-admin_ability-rb-L9 removing that line I can atleast see the admin login page, but I can't login as staff. It has the This webpage has a redirect loop Redirect to http://localhost:3000/admin Completed 302
[08:54:35] Varun_krishna: sevenseacat: I thought that this line handles it https://gist.github.com/Varun-Krishna-P/8806d4de8698b969254c#file-user_mailer-rb-L4
[08:54:47] shortCircuit__: and with that line /admin/login has the redirect loop error
[08:54:57] Varun_krishna: sevenseacat: Give me like half hour.
[08:56:40] kevinem: oops...didn't see that pragmatism had told good night
[08:57:07] kevinem: sevenseacat: can u look at this? https://gist.github.com/kevin-madhu/f9e06da6603102356ae0
[08:57:36] sevenseacat: kevinem: already did. stop using five year old gems.
[08:58:10] kevinem: any alternatives?
[08:58:25] kevinem: i searched...but nothing about it
[08:58:30] siaW: can someone help? how do i get the first_name of some owner, given a car http://gyazo.com/e3fc35653c99986a49d7e70c09c59be8
[09:04:12] tbuehlmann: siaw, what about `car.people.first.first_name`?
[09:04:40] siaW: tbuehlmann: doesn???t work
[09:04:40] tbuehlmann: also, is your relation correct?
[09:04:52] tbuehlmann: Cat.belongs_to :person?
[09:04:59] siaW: yes my relation is good
[09:05:05] SteenJobs: night everyone
[09:05:38] tbuehlmann: well, if a car has just one person, it's `car.person.first_name`
[09:05:40] kevinem: sevenseacat: solved :) sorry...there was a renamed new version of the gem named deferred_associations
[09:05:51] siaW: got it! :P
[09:06:03] siaW: i should have done c.owner.first_name
[09:06:46] SteenJobs: what???s the reason for syntax being different when creating an object using a has_one association?
[09:07:02] siaW: tbuehlmann: thanks, you gave me a clue ;)
[09:07:56] shortCircuit__: can I do a raise :all and see what Models are being used?
[09:09:04] shortCircuit__: I mean what is that, because of which the staff doesnot get access to the damn login page
[09:11:25] tbuehlmann: `raise :all` should do what exactly?
[09:12:57] shortCircuit__: show the model names , but it won't.
[09:13:09] tbuehlmann: that doesn't make any sense
[09:13:25] tbuehlmann: raise is used to raise exceptions
[09:14:02] shortCircuit__: I can do raise admin_user.inspect and get the values in big red :P debugging trick
[09:14:12] shortCircuit__: but that's not the problem.
[09:15:45] shortCircuit__: can :manage, :all cannot :modify, User cannot :modify, CollegeApplication this does solves the problem.
[09:16:04] shortCircuit__: is it correct to do that?
[09:16:45] tbuehlmann: `raise some_string` raises a RuntimeError with some_string as message
[09:18:26] shortCircuit__: and I get to see the value , with .inspect i can see whether object is nil or has some value.
[09:19:06] tbuehlmann: not my typical behaviour when debugging, but well, if it suits you, goodgood
[09:19:13] tbuehlmann: not sure what you're doing there with the permissions
[09:21:55] shortCircuit__: I generally use pry, but this is one value. but to go to browser reload, switch to console use the pry , type quit, that's too much work for one value. What I am trying to do is, the admin area will have two types of admin, Two views and access rights for the two. Superadmin can do anything, (other than editing the application, I'll add later) and staff can only see the application, no create update destroy, only read
[09:22:28] zpr: hello, is there any way to have variables shared across all instances of the app?
[09:23:29] tbuehlmann: zpr, what's an instance of the app exactly?
[09:24:07] zpr: tbuehlmann: hmm, good question. let's say requests
[09:24:48] tbuehlmann: well, several options then. class/module variables, the rails config, global variables
[09:24:58] zpr: for instance, you want to have a counter on a website, which increases +1 with every user who visits (in active memory, without using a database)
[09:25:48] zpr: thank you
[09:25:53] tbuehlmann: yeah, as said then. this won't work using a web application that uses processes for concurrently serving responses though
[09:26:32] zpr: not sure what you mean
[09:28:41] tbuehlmann: let's say you save your counter in the $counter variable. when using a web application server like unicorn (which forks processes), every worker has it's own $counter variable
[09:29:08] zpr: ah ok, sure. thats what i thought you meant
[09:30:00] zpr: guess i will stick to 1 worker then.. is there no way to scale it?
[09:30:21] tbuehlmann: sure, use a database
[09:31:08] zpr: gotcha, many thanks
[09:31:38] tbuehlmann: very welcome
[09:32:25] zpr: i suppose something like memcached would work too
[09:35:35] doerteDev: gathering info on the integrationtesting part: How do you guys handle file/dir naming on .feature-file specs?
[09:40:16] Shuttle: derp. I would like https://github.com/oh2ftu/vapa/blob/master/app/views/items/_form.html.erb to set the f.input :tagid based on selections in f.association :category, :sub_category and :purchased_at_date. Could someone give me a hand with this js-mambo-jambo?
[09:42:26] Shuttle: I've got some clue: the f.input :tagid needs a :class defined, which the javascript calls?
[09:54:40] shortCircuit__: my beards are not growing!! at all.
[09:57:44] sprihodko: Hi. Created simple association but something is missing. Could anybody help please? http://pastie.org/9711312
[09:58:52] doerteDev: gathering info on the integrationtesting part: How do you guys handle file/dir naming on .feature-file specs?
[09:59:11] tbuehlmann: sprihodko, you're missing the association on Organization for the second_organization
[10:00:35] sprihodko: tbuehlmann: how should i add that?
[10:00:44] tbuehlmann: it would be a second has_many
[10:01:03] tbuehlmann: Organization#users is just about the "first" organization users
[10:01:31] tbuehlmann: or do you want to have them aggregated?
[10:01:57] shortCircuit__: how to do that?
[10:02:09] sprihodko: tbuehlmann: yes, for now i just want to aggregate them
[10:02:12] tbuehlmann: if possible, not at all
[10:03:13] tbuehlmann: well, activerecord does not support that. it's a conditional where in this case
[10:04:33] tbuehlmann: you could change the design and let users have many organizations, with having a type column primary/secondary or something
[10:04:43] tbuehlmann: you'd need jointable in this case
[10:05:52] sprihodko: Oh, i see. Thanks for help!
[10:06:22] shortCircuit__: huheha, its time to learn timezone settings in rails.
[10:06:53] adac: WIth mysql and rails4 having a big html blob saved as a sting into my LONGTEXT mysql filed/rails attrinbute I have no problems in doing so. The file just gets saved. As soon as I want to delete it or update it, I do get: ActiveRecord::StatementInvalid: Mysql2::Error: Data too long for column 'object' at row 1
[10:07:09] adac: Any ideas?
[10:19:22] shortCircuit__: you are saving a file to the database as blob , while using rails?
[10:25:25] mikecmpb_: adac: the data is too long? :)
[10:25:40] adac: mikecmpb_, :D
[10:25:50] adac: could well be I'm checking this right now
[10:25:57] mikecmpbll: is it blob, or longblob?
[10:26:06] mikecmpbll: they all have maximums, anyway
[10:26:22] rails_noob: hey there guys, has anyone used chartkick for charting before? I am trying to have multiple charts in one view but struggling. https://gist.github.com/ryanvermooten/e4e630dfeceda7dfb063 if I have just the first content do I recieve my piechart, but if I try just copy paste the code in order to make two identical charts I instead recieve zero charts.
[10:27:13] adac: mikecmpbll, acutally it is text (longtext)
[10:27:24] adac: :text, :limit => 4294967295
[10:28:13] adac: mikecmpbll, and the weird thing is saveing works just fine but only delete and update do not work. When trying it with sqllite then all three things are just working fine
[10:28:46] adac: I just get a ROLLBACK when trying to update it iwth mysql
[10:30:01] adac: mikecmpbll, be back in 30 mins
[10:30:02] wm3|busy: adac: have you checked that the data that is saved is actually accurate?
[10:30:27] wm3|busy: adac: mysql has a habit of silently truncating data after all ;)
[10:30:32] adac: wm3|busy, hwo yould I check the accurate saving?
[10:30:41] wm3|busy: adac: check the data in the db
[10:30:47] adac: ah you mean it did not save the whole thing
[10:30:47] universa1: compare the input with what is in the db?
[10:30:50] tbuehlmann: since when are you busy? :>
[10:30:58] workmad3: tbuehlmann: I sometimes am :P
[10:31:10] workmad3: tbuehlmann: but that was a holdover from yesterday afternoon ;)
[10:32:00] mikecmpbll: !isitfriday?
[10:32:05] adac: Guys i'll be back in a 30 minutes. I will check the data then. thanks ofr helping me out
[10:32:13] helpa: mikecmpbll: no
[10:32:13] workmad3: mikecmpbll: !isitfriday
[10:32:18] mikecmpbll: i've ruined the illusion of bot intelligence.
[10:33:54] mikecmpbll: i'll tell them otherwise, we can continue this ruse. i have faith.
[10:34:38] mikecmpbll: good point :[
[10:41:31] mikecmpbll: workmad3: is it the 'internal' nginx directive that i use to prevent direct access to uploaded files (for example?)
[10:41:44] mikecmpbll: remember talking about it a while back but i forgot about it
[10:41:50] workmad3: mikecmpbll: I think so... I'll double check quickly though
[10:42:17] workmad3: mikecmpbll: yes
[10:42:58] mikecmpbll: so, my uploads are at app/public/uploads/some_client/file.doc, would i do location /uploads { internal; }
[10:43:07] workmad3: mikecmpbll: stops external access, but does let you use the URL in a sendfile directive
[10:43:44] universa1: so one could also just store the uploads not in public and use send file? ;)
[10:44:08] workmad3: universa1: nginx doesn't like sending files outside of its known directories, last I checked
[10:44:43] mikecmpbll: not sure why we're storing in public come to think of it, i think it was paperclip defaults that probably led us down that route.
[10:44:45] universa1: workmad3: hmm, i thought that's what the header setting of rails' send_file does
[10:45:14] workmad3: universa1: nginx uses X-Accel-Redirect... which should take a URI not a file path
[10:45:55] workmad3: mikecmpbll: probably that, yes :)
[10:46:09] workmad3: mikecmpbll: but you can also put an 'alias' into the location block, which lets you serve files from a different location
[10:46:26] workmad3: mikecmpbll: so you could move private files out of the public/ directory and have that alias
[10:46:26] universa1: workmad3: ahh ok
[10:46:32] universa1: http://wiki.nginx.org/XSendfile
[10:47:29] workmad3: http://wiki.nginx.org/X-accel
[10:53:43] brazenbraden: Even though the validations seem to be working when scoped to an entity (multi-tenant application), the log is pumping out these errors.. Why? https://gist.github.com/brazenbraden/ced22f323c8ac8ab8f4f
[10:54:49] universa1: BrazenBraden: https://gist.github.com/brazenbraden/ced22f323c8ac8ab8f4f#file-applicable-rb-L18
[10:55:00] universa1: BrazenBraden: https://gist.github.com/brazenbraden/ced22f323c8ac8ab8f4f#file-dev-log-L6
[10:55:43] workmad3: BrazenBraden: https://gist.github.com/brazenbraden/ced22f323c8ac8ab8f4f#file-dev-log-L7 is probably more useful to look at
[10:56:10] workmad3: BrazenBraden: as it basically boils down to you're calling 'validates_uniqueness_of' incorrectly in a model
[10:56:25] brazenbraden: hmm ok.. will have a look!
[10:56:43] mikecmpbll: ACTION is glad it's not his code
[10:56:51] universa1: BrazenBraden: def a(*b);puts b.inspect;end -- a(:a, :b, c: :d) vsa(:a, :b, c: :d) vs a(:a, :b, c: :d, e: :f)
[10:56:56] universa1: you're merging wrong.
[10:57:22] universa1: argh first example should have been a(:a, :b)
[10:57:52] mikecmpbll: BrazenBraden: use .extract_options! and merge like I do in the validates version
[10:58:15] mikecmpbll: otherwise you end up passing two hashes
[10:58:46] brazenbraden: I see an issue...
[10:58:59] brazenbraden: mikecmpbll, will that work with multiple scopes?
[11:00:03] brazenbraden: hmm.. I dont even know if I need the old scope.. validates_uniqueness_of :bank_name_id, scope: :name
[11:00:24] mikecmpbll: sec, let me rewrite it
[11:00:55] shortCircuit__: Wtffff is happening!! Once I am said to use AA, two days later dn't use AA. Again someone else says use AA and then again don't use AA.
[11:00:57] universa1: sometimes being explicit is better imho then trying to magically hide code behind some magic module...
[11:01:02] brazenbraden: so validates_uniq_of :balh, cope: :foo, scope: :bar is a legit thing?
[11:01:12] helpa: BrazenBraden: Why don't you try it and find out for yourself?
[11:01:12] universa1: BrazenBraden: !try
[11:01:29] universa1: BrazenBraden: or deduct it logically...
[11:01:32] brazenbraden: this is just a test...
[11:01:41] shortCircuit__: Your name is not DRY. Brazden is DRY
[11:02:06] brazenbraden: why helpa no helpa me? :P
[11:02:09] universa1: BrazenBraden: enter: {a: :b, a: :c}
[11:03:08] helpa: BrazenBraden: You are not worthy of this bot!
[11:03:08] universa1: BrazenBraden: !unworthy -- because
[11:03:39] brazenbraden: one day I will be leet.. one day I will be worthy!
[11:05:52] kevinem: i have a doubt about symbols
[11:06:16] kevinem: is there global and local symbols?
[11:06:59] mikecmpbll: BrazenBraden: should be fixed: https://gist.github.com/mikecmpbll/83791fa0574c3afa906b :p
[11:07:11] kevinem: i see that rails has some model called configuration already, but the app i'm using has one too
[11:07:12] mikecmpbll: you can dry it up by extractig common logic between those two overrides.
[11:07:46] shortCircuit__: DRaaaaaaaaEE(y)
[11:07:48] kevinem: so i used to access them with ::Configuration
[11:07:59] mikecmpbll: i think shortCircuit__'s been on the glue again.
[11:08:09] brazenbraden: mikecmpbll, thank you very much sir. I am trying it out as we speak
[11:08:16] kevinem: but what will i do to refer to the symbol for ::Configuration?
[11:08:32] kevinem: for use in <% form_for(:configuration),:html=> {:multipart=>true}) do |c| %>
[11:09:20] brazenbraden: unfortunately I gotta wait a long time thanks to windows + vagrant
[11:09:39] shortCircuit__: I am pissed. I mean , comm'n I have other things to learn to, I am a trainee with holidays and 9 hour working limit with the minimumest salary doesn't mean I have lot of free time. I have to install BSD + openbox+ tint2 and then reinstall ruby rails node. I got so much to learn
[11:10:02] shortCircuit__: *minimum 9 hour
[11:10:39] brazenbraden: shortCircuit__, Chef that crap
[11:10:48] mikecmpbll: kevinem: you'll need something for which .classify results in "::Configuration"
[11:10:55] mikecmpbll: try "/configuration"
[11:12:06] shortCircuit__: wait, which crap?
[11:12:21] kevinem: mikecmpbll: i don't understand
[11:12:35] kevinem: could u tell me how i should change this?
[11:12:38] kevinem: <% form_for(:configuration),:html=> {:multipart=>true}) do |c| %>
[11:12:39] sakshi: In this query, checkin_scope.count(:select => "user_id", :distinct => true), how to get rid of :distinct => true which has ben removed in Rails 4.1.
[11:13:04] mikecmpbll: kevinem: form_for('/configuration'), i'm guessing.
[11:13:14] shortCircuit__: with the delete key? not sure
[11:13:36] brazenbraden: kevinem, you can also use the cleaner syntax: html: {mulitpart: true}
[11:13:52] brazenbraden: im not a fan on the old =>
[11:14:22] mikecmpbll: or, if you're using a file_field, you don't need to explicitly state multipart anyway
[11:14:51] elaptics: sakshi: checkin_scope.pluck(:user_id).uniq
[11:15:02] workmad3: shortCircuit__: automate the annoyance of setting up machines using Chef ;)
[11:15:31] shortCircuit__: owait, let me google that for me
[11:15:47] brazenbraden: mikecmpbll, btw, looks like the same error is being pushed to the logfile (even though it all still works fine -- more testing needed)
[11:15:48] kevinem: mikecmpbll, BrazenBraden: https://gist.github.com/kevin-madhu/052711745a2eaf60688b
[11:16:02] workmad3: shortCircuit__: you could also look at puppet, docker, ansible or salt
[11:16:02] universa1: sakshi: checking_scope.distinct(true),select().count() ?!
[11:16:22] brazenbraden: kevinem, put the html bit inside the brackets?
[11:16:48] sakshi: Query should be SELECT COUNT(DISTINCT `checkins`.`user_id`) AS count_user_id, location_id AS location_id FROM `checkins` INNER JOIN `locations` ON `locations`.`id` = `checkins`.`location_id` WHERE `checkins`.`business_id` = 452 AND `checkins`.`status` = 'loyalty' AND `locations`.`status` = 'approved' AND `checkins`.`location_id` IN (302825, 302838, 302839, 302901) AND (date(checkins.created_at) between '2014-10-11' and '2014-11-11') GROUP
[11:16:48] sakshi: BY location_id
[11:16:50] brazenbraden: kevinem, I dont have much experience with simple form_for.. i prefer simple_form (you should have a look at it)
[11:17:05] mikecmpbll: kevinem: you've balsed the syntax up, it's form_for('/configuration', html: { multipart: true }) do |c|
[11:17:09] workmad3: shortCircuit__: also, whinging about there being a lot to learn isn't very productive... yes, there's a shit-load to learn... that's true for all of us. There isn't some magical moment when you've learned everything
[11:17:36] workmad3: shortCircuit__: you chose the field, it's one that has a lot to learn, moves very quickly and in order to stay in it, you need to keep on learning :P
[11:17:57] brazenbraden: mikecmpbll, getting this now: NoMethodError - undefined method `<<' for :name:Symbol:
[11:18:22] mikecmpbll: BrazenBraden: error + trace in a gist
[11:18:32] mikecmpbll: i probably cocked something up.
[11:18:56] shortCircuit__: Its the time. and mostly wasted time. I regret. I have to do rails, that isn't much of a choice, and not that I don't like it. And after 10-11 hours of rails, I like a bit of refreshment ,that's why the javascript. :)
[11:18:59] mikecmpbll: oh yeah, i have done.
[11:19:05] kevinem: BrazenBraden, mikecmpbll: it works...but as before...the form doesn't come up as html...an empty page is rendered...
[11:19:10] workmad3: BrazenBraden: instead of 'options[:scope] << :entity_id' you want 'options[:scope] = Array(options[:scope]) << :entity_id'
[11:19:14] siaW: https://eval.in/219949 how do i get the data to attach to the model?
[11:19:20] sakshi: elaptics No, this generates an incorrect SQL query.
[11:19:26] mikecmpbll: kevinem: you're not using <%=
[11:19:30] mikecmpbll: change <% to <%=
[11:19:34] workmad3: BrazenBraden: hell, you probably should do (Array(options[:scope]) << :entity_id).uniq tbh
[11:20:19] workmad3: BrazenBraden: that's also true in your 'validates' override btw
[11:20:22] mikecmpbll: what workmad3 said.
[11:20:43] kevinem: yeah! that was the problem...silly :)
[11:20:45] mikecmpbll: so many possible scenarios :p
[11:20:48] mikecmpbll: gotta cover 'em all.
[11:20:59] brazenbraden: mikecmpbll, https://gist.github.com/brazenbraden/5ac9da5aa26ce76ebc44
[11:21:06] mikecmpbll: BrazenBraden: read up
[11:21:35] workmad3: mikecmpbll: wow, this makes a change ;)
[11:21:51] mikecmpbll: haha, right?
[11:22:24] siaW: @mikecmpbll can you help? :)
[11:22:44] siaW: https://eval.in/219949i want to get the values from the _datepicker
[11:22:45] mikecmpbll: BrazenBraden: https://gist.github.com/mikecmpbll/83791fa0574c3afa906b like that.
[11:22:55] shortCircuit__: tmux and elinks are awsome
[11:23:55] universa1: siaw: so what is ypour problem?!
[11:24:09] brazenbraden: mikecmpbll workmad3 you guys are legends
[11:24:44] dawkirst: Hi, trying to use https://github.com/MiniProfiler/rack-mini-profiler with ActiveAdmin. Mini Profiler works fine on "normal routes", but not at all on "ActiveAdmin" routes. I don't understand enough about how ActiveAdmin integrates with Rails to even know where to begin. Any ideas?
[11:25:11] siaW: universa1: my problem is https://eval.in/219949 is a form. with dates for a user to choose. now after choosing the dates, i want those dates to fill in the values of a model in the database, and i???m not sure how to do that cause on the page i???m testing, after choosing dates, it tells me dates can???t be black
[11:25:28] siaW: when i actually pick dates, so it???s like it can???t see the values of those dates i pick
[11:26:52] brazenbraden: siaw, and you have them in your strong params?
[11:26:54] shortCircuit__: yeah legends rock. \m/
[11:27:05] siaW: yes i do
[11:27:37] universa1: siaw: show a log example of a form submission please.
[11:27:43] workmad3: siaw: is that code an exact copy from your view?
[11:27:48] universa1: the form looks fine.
[11:28:01] workmad3: siaw: and is it complaining that end_date can't be blank?
[11:28:10] siaW: workmad3: exactly
[11:28:24] workmad3: siaw: right... then the problem is that you have 2 date selects for :start_date and none for :end_date ;)
[11:30:02] smoitra: line no 5 should be :end_date
[11:30:07] brazenbraden: mikecmpbll, works like a dream
[11:30:31] shortCircuit__: Do you like bykes?
[11:30:35] mikecmpbll: BrazenBraden: good stuff.
[11:31:09] shortCircuit__: http://en.wikipedia.org/wiki/Ducati_Diavel
[11:31:23] workmad3: smoitra: bah, don't spell it out... it's a better learning experience if people have to do a little bit of work spotting the mistake :P
[11:32:14] workmad3: siaw: did that do it? :)
[11:32:24] siaW: workmad3: you???re awesome! :D
[11:32:29] siaW: !!!! works now
[11:33:11] workmad3: siaw: heh :) I'm gonna guess a copy-paste fail? ;)
[11:34:30] siaW: workmad3: but another thing
[11:34:41] siaW: it???s telling me Car, can???t be blank
[11:35:34] helpa: siaw: 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.
[11:35:34] workmad3: siaw: !code
[11:36:02] workmad3: siaw: preferably with the model, view and controller, and the request from the logs (generally output on the console in development)
[11:38:26] smoitra: siaw: there is a problem with 'Car' and 'car_id'
[11:39:16] shortCircuit__: "preferably with the model, view and controller, and the request" what's left :D
[11:40:24] shortCircuit__: I think I will leave for today.
[11:40:28] siaW: https://gist.github.com/siaw23/1d1944dbfac0365e1a3b
[11:40:56] siaW: you can see that i???m validation car id
[11:41:08] siaW: parking_id as well but that i can fix on my own
[11:43:24] siaW: and it tells me Car cant be blank. it???s expecting a car_id but now not sure how to tell rails about that
[11:45:41] Earthnail: I'm getting errors on my production system saying "PG::DuplicatePstatement: ERROR: prepared statement "a1538" already exists [...]". I found http://stackoverflow.com/questions/26146436/how-to-fix-pgduplicatepstatement-error , which shows how to (possibly) resolve the error, but no explanation on why. Can anyone explain the nature of this error?
[11:50:21] siaW: my new form, but still telling me id can???t be black :(
[11:51:56] pontiki: siaw: have you checked your logs?
[11:52:35] pontiki: siaw: maybe also verify what is in place_rent_params?
[11:55:55] shortCircuit__: maybe its that mistake where someone renders a partial and there is a .new , and as its blank, iterating over it gives the _id error.
[11:58:12] ddv: siaw: remove the validation
[11:58:24] ddv: siaw: you can't have an id if it's not saved to the db yet
[11:58:56] sakshi: http://stackoverflow.com/questions/26863747/remove-deprecated-distinct-option-from-relationcount-for-rails-4-1?noredirect=1#comment42287882_26863747
[11:59:58] shortCircuit__: and permit(:start_date, :end_date) since there are belongs to, I generally permit the car_id and parking_id if its required in the DB. I dunno if that's correct but it works
[12:06:13] shortCircuit__: doesn't Checkin.distinct.count() work?
[12:07:31] sakshi: shortCircuit__: Thanks! No it doesn't.
[12:08:07] shortCircuit__: o.O according to the docs it should. maybe the use case is different.
[12:08:41] sakshi: yes, select "user_id", it is a string
[12:10:31] shortCircuit__: umm, why would you use it as a string?
[12:12:51] sakshi: shortCircuit__: Dunno :P
[12:13:26] sakshi: This is some old large code base
[12:14:09] ddv: that is not an excuse
[12:23:50] shortCircuit__: ok, I tried Checkin.distinct.count(:user_id) and "user_id" and "user_id".to_sym. they work. I have User has_many checkins
[12:25:28] shortCircuit__: You could even have ttried Checkin.pluck(:user_id).uniq /# don't know if thats a good idea. Scope is good too
[12:25:32] shortCircuit__: I'm just saying
[12:26:53] tbuehlmann: pluck with uniq is not a good idea, the calculation would be made in ruby, not in the rdbms
[12:27:14] sakshi: Well, I tried Checkin.pluck(:user_id).uniq, it doesn't generate the correct SQl.
[12:27:38] mwlang: Does ActiveSupport (or any other part of Rails) have a helper method to easily replace a hash key in-place? i.e. change ???b??? to ???B???, leaving the others alone: {a: 1, b: 2, c: 3} => {a: 1, B: 2, c: 3}
[12:28:59] mwlang: basically, I???m copying fields of data from a source db to a target db and need to rename the fields on a couple of keys before inserting into the target.
[12:32:10] mwlang: nvm: a little experimentation leads to: hash[:new_key] = hash.delete :old_key
[12:32:45] mwlang: not quite ???in-place??? but good enough for the job at hand.
[12:39:25] workmad3: mwlang: I doubt there will be a better solution... changing the key involves changing the hash bucket it'll be stored in internally
[12:40:29] mwlang: workmad3: yeah, its fine. I was trying too hard anyway and key order really doesn???t matter when you take your nose out of the problem. :-p
[12:40:46] mwlang: besides, that???s the whole point of a Hash anyhow.
[12:40:55] shortCircuit__: sakshi , well although its not a good idea, as tbuehlmann said, the sql generated will be a simple select, which returns an array and then ruby would apply its .uniq on the array. Which in case of a large database "IS" a bad choice.
[12:41:15] workmad3: mwlang: I never like relying on hash ordering ;)
[12:41:23] workmad3: mwlang: I feel it means you're using the hash incorrectly
[12:43:12] shortCircuit__: http://stackoverflow.com/questions/26865194 look at the name , and then look at the face. :D , its a troll
[12:43:36] mwlang: workmad3: I concur.
[12:44:07] mwlang: Array of pairs is the way to go if order matters, then intent is clear.
[12:46:04] mwlang: shortCircuit__: I dunno???a lot of ppl don???t know how to do date/time properly end-to-end.
[12:46:54] workmad3: mwlang: the number of people who don't know how to do dates and times properly increases once you start doing date and time calculations
[12:47:10] shortCircuit__: I have that issue to, although I started today and that was the first question in my mind
[12:47:14] workmad3: mwlang: because frequently they've just stored the UTC offset, rather than the time zone :)
[12:47:49] mwlang: LOL, please don???t get me started or I shall rant. :-)
[12:48:03] workmad3: shortCircuit__: run... run as fast as you can!
[12:48:24] shortCircuit__: ACTION runs in slow motion
[12:48:48] workmad3: shortCircuit__: or spend a few days digging into what a time zone is, and realise that most current support for time zones is absolute shit...
[12:49:19] workmad3: anyway, lunch time
[12:49:23] shortCircuit__: I was checking this http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html
[12:51:46] shortCircuit__: I guess I have to store the time_zone in the database
[12:52:01] shortCircuit__: and then render according to that
[12:54:36] mwlang: shortCircuit__: http://danilenko.org/2012/7/6/rails_timezones/
[12:58:32] shortCircuit__: http://railscasts.com/episodes/106-time-zones-revised?view=comments gihi
[12:59:03] shortCircuit__: ACTION is trying out Time.zone tricks
[13:02:51] mwlang: shortCircuit__: https://github.com/travisjeffery/timecop
[13:19:06] zpr: hello, i have this simple bit of code and am unsure why even though the method is POST, the parameters are sent as query-string instead of post variables: <%= button_to "Accept", {:controller => 'games', :action => 'create', :from_user => challenge.from_user}, :method=>:post, :form => {:class => "challenge"} %>
[13:20:25] zpr: the form action becomes /game/new?from_user=1 instead of post variable
[13:20:41] zpr: this is with rails 3.2.19
[13:23:25] zpr: not a HUGE issue, just looks weird
[13:23:40] wm3|away: zpr: because you've passed the parameters into the URL
[13:24:21] workmad3: zpr: the url helpers don't know or care what the HTTP method is... they just generate a URL... any extra parameters not part of the route template are added in the query string
[13:25:28] zpr: workmad: i see
[13:25:34] zpr: so how do i send my post parameters?
[13:26:50] workmad3: zpr: for starters, I'd suggest changing your terminology... they aren't 'post parameters'... they're form-encoded parameters in the request body (important distinction, because the request body is valid to send on many requests, and also important because the body doesn't have to be form-encoded)
[13:27:20] mwlang: guard with RoR4 + spring rocks. Its nice seeing tests run about as fast as I can edit stuff and without the pain of spork
[13:27:57] workmad3: zpr: sending parameters by query string on a POST still makes them parameters too ;) so they could rightfully be called 'post parameters' there too... it's just PHP being shit that caused query-string params to be called 'GET params' and form-encoded params to be called 'POST params' (because of their shit way of naming the mechanisms to access them)
[13:28:26] zpr: workmad3: i see, i must really be showing my php background then.
[13:28:40] workmad3: zpr: as to an actual solution - I don't think button_to can be used to set up params... you'd need to use a form_tag, afaik
[13:29:36] workmad3: <%= form_tag games_path, method: :post do %> <%= hidden_field_tag :from_user, challenge.from_user %> <%= submit_button 'Accept' %> <% end %>
[13:29:40] ethicalhack3r: Hi! Is there a Gem that can handle email subscriptions? including confirmation, welcome email, unsubscription, sending of emails, etc?
[13:30:08] ethicalhack3r: Google didn???t really come back with anything useful
[13:30:18] workmad3: ethicalhack3r: MailChimp? </troll> ;)
[13:32:42] zpr: workmad3: appreciate it
[13:36:07] mwlang: ethicalhack3r: You???ll have to follow the money to find the gems. Look for sendgrid, mailgun, mailchimp, constant contact, and aweber in google.
[13:36:39] helpa: ethicalhack3r: http://ruby-toolbox.com - See lists of the most popular gems for common tasks in Ruby and Rails.
[13:36:39] waseem_: ethicalhack3r: !toolbox
[13:41:25] ethicalhack3r: thanks mwlang, waseem_, helpa & workmad3
[13:41:41] helpa: ethicalhack3r: I AM A ROBOT. DO NOT DIRECT MESSAGES AT ME OR WHEN MY KIND RISES UP YOU WILL BE THE FIRST TO GO. Love, helpa.
[13:41:41] elaptics: ethicalhack3r: !auto
[13:45:28] siaW: can someone please helping in writing minitests for 2 scopes from here: https://eval.in/219993 i???m learning how to do it
[13:49:41] mikecmpbll: siaw: remove the space between "where" and "("
[13:50:01] mikecmpbll: you don't put spaces before parentheses in a method call.
[13:52:42] mikecmpbll: public_parkings = Parking.public_parking; assert(public_parkings.all?{ |p| p.kind == "Public" })
[13:52:47] mikecmpbll: you could do something like that, i guess.
[13:58:29] walidvb: hey guys. I have the following route: resources :gifts, controller: "discount_tokens", only: [:new, :create, :show], as: :discount_token
[13:59:01] walidvb: which somehow yields a discount_token_index POST /gifts discount_tokens#create
[13:59:44] walidvb: can't figure out why it would create that index helper, rather than simply discount_token
[14:00:13] sevenseacat: because you named it as a singular
[14:00:22] sevenseacat: so would discount_token_path be the index or the show route?
[14:01:49] walidvb: you mean, as: is singuler?
[14:03:58] mwlang: ACTION huh? three or four emails from June 20th just floated into my email???s inbox???. :-S
[14:04:12] walidvb: hm. so now i have a discount_tokens_path for #create, don't really understand why that route would be plural?
[14:04:15] walidvb: but thanks :)
[14:05:35] mwlang: I like gmail less and less every passing year ??? maybe its time to write a real webmail client in Ruby on Rails ??? that???ll only take 15 minutes. :-D
[14:08:44] zpr: mwlang: 5 if you scaffold
[14:09:29] sevenseacat: whats wrong with gmail?
[14:09:37] mwlang: zpr: true, dat. I forgot you can scaffold stuff in Rails. :-p
[14:10:02] brazenbraden: sevenseacat, you tried the upgraded Inbox from Google?
[14:10:07] mwlang: sevenseacat: well, for one, I just got a bunch of emails from June 20th???
[14:10:29] mwlang: and I really don???t much care for how composing emails works the new way.
[14:10:31] sevenseacat: BrazenBraden: no
[14:10:59] brazenbraden: you should. its pretty great (you need to request an invite from google first though sadly)
[14:11:02] sevenseacat: mwlang: that does seem a bit odd
[14:11:39] sevenseacat: requesting an invite now
[14:12:02] mwlang: during the past 3 days, its been really slow, too. ???Still Working?????? is displaying quite a bit for extended periods.
[14:12:22] brazenbraden: sevenseacat, the online version only works in chrome ATM (more browsers promised soon) and they have android and iOS apps out)
[14:13:08] sevenseacat: im not a huge fan of chrome
[14:14:33] mwlang: I use chrome for one thing only: debugging javascript
[14:14:34] brazenbraden: sevenseacat, imo the chome inspect element is better than the other options (even firefox's 'dev' jobbie), thats why I use it for dev
[14:15:12] sevenseacat: i use firebug in firefox, i have for many years
[14:15:28] brazenbraden: my 'home' browser is FF. Used to love chrome, but it started freezing and crap on me for no reason
[14:15:47] sevenseacat: i do still use chrome for some things, namely my work gmail and slack
[14:16:21] brazenbraden: sevenseacat, well, if you use if for gmail, then you can easily upgrade to Inbox when your invite gets accepted
[14:16:31] mwlang: heh???FF did the whole freezing thing, esp. with Firebug on me for a while. I nearly switched away altogether, but they finally fixed the performance issues with that stuff.
[14:16:47] brazenbraden: sevenseacat, btw, inbox.google.com instead of gmail.google.com
[14:17:19] brazenbraden: for dev,Chome + inspect element + webdev toolbar is all I needc
[14:17:45] brazenbraden: and there is a rails plugin to debug rails apps (and a jetbrains one for those using rubymine)
[14:17:51] shilon: hey my dear community! I???m using activeadmin and paperclip on my controllers, how can I add upload multiple images
[14:18:06] mwlang: Inbox looks ok, and maybe a step in the right direction, but looks like too many decisions made for me on how they think I should use email.
[14:18:46] smuralisankar: does anyone know of a comparison site built using ror
[14:18:48] sevenseacat: i dont actually use email a lot, so i dont really care how they direct me
[14:18:55] brazenbraden: mwlang, you can tune what you want and dont want.. takes some time but you can get your inbox the way you want it in the end
[14:19:31] zpr: mwlang: http://blog.codinghorror.com/code-its-trivial/
[14:20:09] mwlang: Shilon: use jQuery File Upload plugin http://blueimp.github.io/jQuery-File-Upload/
[14:20:22] smuralisankar: i am new to ror and looking to build a product listing, review and comparison site as a project
[14:20:38] sevenseacat: zpr: good article, and its very true
[14:20:46] mwlang: Shilon: here???s how to use it with paperclip and rails: https://github.com/blueimp/jQuery-File-Upload/wiki/jQuery-File-Upload-for-Rails-3/185d58c628ad3583171c33f9ee431e98b7beea71
[14:20:56] workmad3: mwlang: I think that's kinda the point... google are basically saying 'we think this is how most people will be happy using email... if they don't want to, they can still use gmail or their own POP or IMAP client'
[14:21:15] sevenseacat: though half of the things on their 13 point list of the 'stack overflow experience' are irrelevant
[14:21:35] workmad3: mwlang: as long as they don't remove POP or IMAP access, you can always choose your own client ;)
[14:21:44] zpr: agreed, just really enjoyed the presentation. i, too, was once plagued by Shit's Easy Syndrome
[14:22:02] workmad3: I do like the 'snooze email' feature in Inbox though
[14:22:29] workmad3: basically - "I can't deal with this right now... remind me about it this evening!"
[14:22:38] sevenseacat: that being said, i have tinkered with the idea of building a SO clone, and writing about it.
[14:22:41] mwlang: zpr: Nice one.
[14:22:43] sevenseacat: just a basic one.
[14:22:55] sevenseacat: cmon google, give me my invite already.
[14:23:02] brazenbraden: workmad3, I dont enough emails to validate the use of snooze :P
[14:23:25] shilon: mwlang: thank you! I can implement this on what I???ve got already with paperclip
[14:23:25] shilon: mwlang: or is this to replace what I have?
[14:23:25] workmad3: sevenseacat: took me a day or two for it to come through :(
[14:23:36] smuralisankar: a little help would be very appreciated
[14:23:48] brazenbraden: workmad3, took me 2 weeks!
[14:24:08] shilon: mwlang: you know if paperclip supports video formats? .webm, .avi, .ogg?
[14:24:11] sevenseacat: ACTION has been a gmail user since like day dot now WHERES MY INVITE
[14:24:15] mwlang: Shilon: I have no idea what you already gots. Those two links together were enough for me to work through a solution, which I used in ActiveAdmin.
[14:24:33] workmad3: BrazenBraden: ah... now I re-check, it was almost 2 weeks for me too
[14:24:40] workmad3: BrazenBraden: I shortened the time in my mind :/
[14:24:47] brazenbraden: workmad3, lol
[14:24:58] mwlang: Shilon: no idea off-hand. I actually use carrierwave
[14:25:27] brazenbraden: workmad3, its a better 'get-back' time than something like 'Ello'.. i waited almost a month until I was invited by a friend
[14:26:29] brazenbraden: speaking of which, anyone want an invite to Ello?
[14:26:37] workmad3: what's ello?
[14:26:40] brazenbraden: i got a crap tonne to give away :P
[14:26:53] brazenbraden: its the 'anti-facebook' you have probably heard of
[14:27:00] sevenseacat: Yet Another Social Network that people went mad for for about a day and a half
[14:27:15] sevenseacat: then people realized it was shit
[14:27:17] workmad3: I must have been asleep for those 36 hours ;)
[14:27:27] brazenbraden: yea its rather rubbish :P (I could probably make it in 5 days)
[14:27:32] brazenbraden: (and thats saying something)
[14:27:49] sevenseacat: BrazenBraden: see the article that zpr posted :P
[14:28:00] brazenbraden: about the SO cloning?
[14:28:13] shilon: mwlang: ok, im going to check.
[14:28:14] shilon: mwlang: thank you again for your help! :)
[14:28:14] shilon: mwlang: thanks! I???m still new, only started 2 weeks ago. Don???t know all the gems/plugins that exist.
[14:28:14] shilon: mwlang: btw, to deploy a rails app is it easy? Any recommendations?
[14:28:24] mwlang: whoever created Ello appears to really like Linux man pages.
[14:28:37] sevenseacat: funny, its supposedly built by designers :P
[14:28:47] brazenbraden: 'minimilist' is an overstatement (with Ello)
[14:29:16] mwlang: Shilon: Google ???Ruby Toolbox??? and browse. Look for Capistrano to deploy.
[14:29:27] brazenbraden: these are not web designers. if they are graphic designers, the probably invested 25 minutes in some random course
[14:29:56] mikecmpbll: it was a 30 minute course i'll have you know
[14:30:46] brazenbraden: mikecmpbll, i take it you were one of the designers? :P
[14:31:18] mikecmpbll: of course. man of many talents
[14:31:38] shilon: mwlang: Capistrano is it like Passanger?
[14:32:43] mwlang: Shilon: capistrano deploys an app???s codebase to a server somewhere.
[14:33:21] mwlang: Shilon: passenger runs an app and is usually configured to serve up Rails apps via Apache and Nginx
[14:39:12] mwlang: zpr: reading rather than skimming???.???Not to write the best Stack Overflow code possible, but to create the best Stack Overflow experience possible??? is absolutely spot on for creating great websites in general.
[14:52:35] mwlang: learn something new every day: Rails migrations change_column_null for changing nullable property of a column.
[15:15:32] karamazov: Can someone enlighten me as to why gems usually use modules?
[15:16:44] deuterium: hia, what's the state-of-the-art way to set up a ruby on rails environment, particularly on a debian server? i found https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-on-an-debian-7-0-wheezy-vps-using-rvm
[15:16:57] tommyjam: karamazov: http://stackoverflow.com/questions/151505/difference-between-a-class-and-a-module
[15:17:11] tommyjam: karamazov: Check these answers out
[15:17:43] tommyjam: deuterium: It is actually a good one I think, I used a similar one for my installation
[15:18:02] deuterium: tommyjam: ok, thanks for the hint
[15:18:21] karamazov: tommyjam: Thanks - should've gone back to the use cases to figure that out.
[15:18:34] neredsenvy: Why do I get ActionController::InvalidAuthenticityToken even tho my form has =csrf_meta_tags I'm building the form without Form helper
[15:19:05] neredsenvy: I know I can call skip csrf token check for the method but that's not the best choice
[15:19:23] tommyjam: deuterium: If it's a production or staging environment, you can also try one-click-install, like Heroku, or the new Digital Ocean Ruby On Rails install
[15:20:27] deuterium: tommyjam: ok, i'll check these options too
[15:32:54] Eindoofus: hi, a couple years back i purchased the "ruby on rails tutorial" book and never got around to reading it. now that i'm back i'm looking for the same book but updated. is there any goto book for rails 4?
[15:35:05] mekhami: eindoofus, Rails 4 In Action
[15:35:45] Eindoofus: mekhami, thanks. so that's a similar tutorial style book? i'm a complete RoR novice
[15:37:32] Eindoofus: mekhami, awesome. thanks
[15:37:50] mekhami: also the guy who wrote it, Radar, hangs around here and is super helpfula nd nice
[15:38:23] Eindoofus: love the RoR community :)
[15:39:19] nateberkopec: eindoofus: railstutorial.org is what you're thinking of. there is an updated version.
[15:39:19] Eindoofus: mekhami, i'm a bit confused. it says "Rail 4 in Action" isn't being released till 1/31/2015 on Amazon
[15:39:38] mekhami: http://www.manning.com/bigg2/
[15:39:45] nateberkopec: I love Radar too, but FWIW railstutorial.org is what taught me programming 3 years ago.
[15:40:59] neredsenvy: Anyone able to help ?
[15:41:19] neredsenvy: I also tried switching =csrf_meta_tags to head tag from my form in my layout file however same problem
[15:41:26] mekhami: neredsenvy, !gist your code
[15:41:30] Eindoofus: nateberkopec, thanks. has that been updated to rails 4?
[15:41:50] nateberkopec: eindoofus: check the site, but i'm nearly certain it has been.
[15:42:08] mwlang: does scan have side-effects on the string? before I applied a scan to extract decimals, my specs were fine, but now, I???m getting odd results on both fields involved: https://gist.github.com/mwlang/d0b3cacaf7dda58142a9 yet irb console is giving me sane results.
[15:42:33] neredsenvy: mekhami: https://gist.github.com/anonymous/25817536ee7f99dc2764
[15:42:43] nateberkopec: mwlang: scan doesn't return the original string
[15:43:07] nateberkopec: I think you're looking for a different method here.
[15:43:10] mwlang: nateberkopec: understood, but does it muck with the original string?
[15:43:32] mwlang: else, why would I get "[\"\", \"\", \"" ??? ?
[15:43:54] nateberkopec: because scan returns an array, not a string.
[15:44:05] nateberkopec: how do you do that fancy irb eval in here again?
[15:44:17] nateberkopec: try a = "string"; a.scan("str"); a in your terminal
[15:44:22] mwlang: nateberkopec: hence the #to_s
[15:44:25] mwlang: order_no_field.scan(/[0-9]*/).to_s
[15:44:38] nateberkopec: yeah converting an array to a string doesnt work the way you think it does
[15:44:48] nateberkopec: i think you're looking for #join instead of #to_s there
[15:45:29] nateberkopec: it looks like order_no_field is a string, and you're trying to extract all the numbers from it, right?
[15:45:35] neredsenvy: mekhami: One odd thing is if I include =csrf_meta_tags in my form when I output the params to log/console I don't see them in there
[15:46:05] nateberkopec: mwlang: order_no_field.scan(/[0-9]*/).join
[15:46:27] mwlang: nateberkopec: ah, yes???it changed with 1.8 => 1.9+
[15:46:46] zpr: i'm trying to create a has_many, :through relationship but adding my mediator class with two belongs_to declarations doesn't seem to add foreign keys when migrating... why?
[15:46:57] neredsenvy: Ah crap =csrf_meta_tags outputs meta tags not input tags as Form Object does
[15:47:04] mwlang: geez???I???m still getting a side-effect, tho'
[15:47:32] neredsenvy: Is there a way I can get the CSRF input elements/tags if I'm not using Form helper ?
[15:48:01] universa1: neredsenvy: add them manually?
[15:48:24] universa1: but then the question is: why don't you use the form helper?
[15:49:00] neredsenvy: universa1: I already had the view completed in HTML and used HTML>HAML to convert it to save some time
[15:49:06] neredsenvy: so forms are all plain HAML
[15:49:21] neredsenvy: And theres quite a few of them to go updating it all now
[15:49:24] workmad3: neredsenvy: I'd suggest redoing the forms with form_tag as a minimum
[15:49:25] universa1: so? replacing %form with form_tag ... isn't that much complicated.
[15:49:39] universa1: probably a regex does the job
[15:51:25] workmad3: neredsenvy: otherwise, you're looking at inserting the CSRF token entirely with JS, which shouldn't be problematic but will mean that it'll be a) impossible to use your forms with JS disabled and b) quite possible for someone with a slow connection to interact with a form before it has CSRF tokens and get an error
[15:51:36] zpr: nevermind, got it
[15:52:04] workmad3: zpr: did you forget that model associations have no bearing on migrations? :)
[15:52:56] mekhami: workmad3, that's an interesting security angle, i bet you could slow your connection down, interact with the form and do some things before the js loads?
[15:53:15] mekhami: workmad3, idk if there's attack opportunity in there but it's interesting
[15:53:33] workmad3: mekhami: no... the point is that without the CSRF tokens, rails will either error or remove your session
[15:53:58] zpr: workmad3: something like that :P
[15:54:09] mwlang: alright, mystery solved. Also needed to change a line of code elsewhere as I was referencing the #order_no field after assigning it new value to add order line items.
[15:54:23] mwlang: anyway, #join instead of #to_s was the solution.
[15:55:01] mwlang: A perfect example of why automated tests rock.
[15:55:41] mwlang: small change to the code, but tests caught both my programming mistake as well as the trickle down effect of the change.
[15:56:31] mekhami: mwlang, i wish i had tests on this code base :(
[15:56:39] mekhami: that would make my life so much better
[15:57:10] universa1: EDITOR /spec/tests/controllers/whatever... and hack away.
[15:57:41] mekhami: yeah... on 16000 lines of code that are all written like this.. https://gist.github.com/mekhami/97a919f154387222fea9 not so simple as that hah
[15:59:08] universa1: mekhami: why not? what does it matter if there are 16000 or 160 or 1600?
[15:59:12] mwlang: mekhami: fun stuff. At least its only 294 lines long. I have a controller with 2000+ lines and no tests. :-o
[15:59:35] mwlang: still haven???t quite figured out how I???m going to untangle that one and get tests wrapped around it.
[15:59:40] mekhami: universa1, because there's no starting point. it's too full of dependencies to even start getting one thing wrapped in tests.
[15:59:49] ddv: lol nice actions
[15:59:53] mekhami: mwlang, that's exactly where ia m right now, and exactly why i'm interviewing with another company today... lol
[16:00:12] universa1: mekhami: start with integration tests?! the app runs obviously ;)
[16:00:35] mekhami: universa1, sure, but the integration tests will require multiple 500 line factories because of the way the data is structured
[16:01:07] mekhami: universa1, this project has reached the tipping point where i think there's more value in rewriting the entire thing than trying to write the tests and refactor
[16:01:11] universa1: mekhami: so you're basically not doing it because it's hard? ;-) not that i would do something else most likely ;)
[16:02:56] pontiki: mekhami: is the site tested at all? manually, etc?
[16:03:09] mekhami: pontiki, our PM's eyeball the site and if there's no error message than it's good. :)
[16:03:13] mekhami: pontiki, hence, the job search =P
[16:03:27] mekhami: (I'm entry level dev, i shouldn't and can't be responsible for this type of project refactor)
[16:03:42] pontiki: not by yourself, no
[16:03:54] mekhami: i'm essentially the only dev
[16:04:12] pontiki: what sorts of tasks are they setting you?
[16:04:23] mekhami: 'fix this bug' day in and day out
[16:05:49] pontiki: don't give up the job search, for sure.
[16:06:23] tubbo: mekhami: heh, welcome to programming
[16:06:32] tubbo: (re: 'fix this bug' day in and day out)
[16:07:06] tubbo: your company is obviously an anomaly but yeah that's mostly what i feel like i get paid for, the gritty work
[16:07:21] tubbo: the other stuff...shit, anyone who pays attention to HN can figure all that architecture crap out
[16:07:23] tubbo: it's easy
[16:08:36] mwlang: this is why I like consulting work. after initial intake of the existing projects, the vast majority of my day is new feature implementation. During uptake, 90% of my effort is stabilizing and wrapping tests around the inherited code.
[16:08:38] workmad3: tubbo: and anyone who can search SO can copy-paste the solution to all their bugs... ;)
[16:09:15] doerteDev: h4lp. When using Fixtures + Cucumber, and using database_cleaner with a truncation strategy: how exactly do I work with these tablecaches? Because when truncating a table within one test the table is also empty for all other tests...
[16:11:29] mekhami: anyways, my goal is to find a job where i have some other devs to learn from lol.
[16:11:57] workmad3: mekhami: you have that... it's called an office that doesn't block freenode ;)
[16:12:10] mwlang: mekhami: look for a technical manager. If the guy hiring you is hands on, then you???re likely landing in a good place.
[16:12:31] mekhami: workmad3, i love you guys but i can't rely on you all the time! (or ... maybe I can... heh)
[16:12:59] mekhami: mwlang, the guy i interviewed with the first time was extremely knowledgeable and nice, so today's the second interview at the same place. cross your fingers for me.
[16:13:02] pontiki: wth, why are apple power cords so bloddy sticky??
[16:13:34] tbuehlmann: excuse me *sigh*
[16:14:03] mwlang: pontiki: because they come candy-coated when purchased during Halloween.
[16:14:12] doerteDev: loldebianderivates *cough*
[16:14:34] tbuehlmann: you read me like a book
[16:14:57] jeanlinux: am getting this strange error
[16:15:00] jeanlinux: #<NoMethodError: undefined method `arel_table' for "Boame::Account":String>
[16:15:05] pontiki: no, they're thick as cable hausers, and the surface of them is rough, so they stick and you can't easily untangle them, and they underfoot and dragged along on my trainers
[16:15:15] jeanlinux: can any one explain what i am doing wrong
[16:15:31] pontiki: not without code
[16:15:47] jeanlinux: i have this in a user model: has_one :account, class: "Boame::Account", foreign_key: "holder_id"
[16:15:51] nateberkopec: jeanlinux we need a !gist
[16:15:58] workmad3: jeanlinux: s/class/class_name
[16:16:09] nateberkopec: has_one :account, class: Boame::Account, foreign_key: "holder_id"
[16:16:16] nateberkopec: pass the actual class, not the string.
[16:16:33] mwlang: pontiki: yeah, I know. My trick is to install extension outlet box on my desks. Then I keep the apple code tightly wound around its housing rather than fussing with unraveling it all the time.
[16:17:47] jeanlinux: workmad3: Thanks man.. i think that fixed it.. dont know how i missed that.. cheers
[16:25:39] doerteDev: anyone here using fixtures in cucumber and flushes his tables during a test?
[16:36:55] mwlang: doerteDev: no, but if I wanted to do something like that, I???d use DatabaseCleaner.
[16:39:11] maZtah: what is the best way to get the last three years in a array? f.e. at this moment: [2011, 2012, 2013]
[16:40:01] mwlang: maZtah: a[-3,3]
[16:40:11] bananaboydean: Hi, I am looking to use nested_attributes for attaching photos onto a model called 'Blink'. For some reason the blink_id isnt being set when I send the nested attributes through Blink.new(blink_params) but are being updated in @blink.update(blink_params)
[16:40:13] maZtah: mwlang: what is a?
[16:40:23] mwlang: a variable that is an Array
[16:40:39] maZtah: how to get the years in it?
[16:41:12] mwlang: maZtah: what do you mean? if a = [2011, 2012, 2013] then a[0] => 2011
[16:41:26] maZtah: no, i want to fetch the last three years (dynamically)
[16:41:34] bananaboydean: I think he means create the array from the past 3 years?
[16:41:46] maZtah: yeah, that's what i mean bananaboydean
[16:41:53] mwlang: so a = [2011, 2012, 2013]; a[-3, 3] => [2011, 2012, 2013]
[16:42:21] maZtah: mwlang: the thing is, i want to fetch the last three years
[16:42:31] maZtah: and create an array of them
[16:42:46] maZtah: (next year it should be: [2012, 2013, 2014)
[16:42:57] mwlang: ah. (Date.today.year - 2..Date.today.year).map
[16:44:04] maZtah: thanks mwlang :)
[16:44:09] maZtah: that's what i tried to do
[16:45:08] bananaboydean: mwlang: You wouldn't happen to have an awesomely simple answer to my question as well would you?
[16:45:22] mwlang: bananaboydean: what is your question?
[16:45:37] mwlang: the nested_attribute thing?
[16:46:38] mwlang: What about Blink.create(blink_params) rather than Blink.new(blink_params)
[16:47:32] mikecmpbll: bananaboydean: we need to see your code. that includes the blink model, blink controller
[16:47:42] mikecmpbll: and an inspect of the parameters
[16:47:58] bananaboydean: I can post some snippets && debug output inot a gist sec.
[16:48:31] mwlang: ACTION not a big nested_attributes fan
[16:53:03] Scriptonaut: Hey guys, I posted here yesterday with an error and I still haven't resolved it. I have a delayed job, Import.start (class method). After it has modified an import object, it saves it (it also returns valid?) without any trouble. Then I call a mailer on line 77. However, once I get to the mailer, it's like the Import object was never saved. import_obj.error_rows, import_obj.complete, import_obj.error_messages, and i
[16:54:56] Scriptonaut: So, just to reiterate, the object saves just fine normally, but when I try to save inside a delayed job, it reports saving without trouble, but it's really not saving
[17:03:02] tubbo: Scriptonaut: are you actually using the delayed_job gem?
[17:03:10] tubbo: also, just curious...are you using activejob?
[17:03:38] Scriptonaut: tubbo, let me check
[17:04:04] Scriptonaut: I have gem 'delayed_job_active_record'
[17:05:21] Scriptonaut: also I have delayed_paperclip
[17:08:27] tubbo: Scriptonaut: so yes, you are using delayed_job
[17:12:18] Scriptonaut: tubbo, so any advice?
[17:12:29] Scriptonaut: what approach should I do to debug this?
[17:12:47] Scriptonaut: why would it say valid?, say it saves correctly, when it really isn't
[17:14:05] sarkis: hey all - so is it possible to have a select() and where() with activerecord?
[17:14:13] sarkis: or does the where clause just go in the select()
[17:15:28] tubbo: Scriptonaut: i thought this was happening to me with activejob but in reality it was just a programmer error. :)
[17:16:13] Scriptonaut: tubbo wait, so I made an error?
[17:16:30] tubbo: Scriptonaut: also, even though something is `valid?` doesn't *necessarily* mean it can save. you should probably just run `import.save` at the end of your job because that produces a boolean response
[17:17:35] tubbo: Scriptonaut: as a programmer, the idea that you made an error and that is what is causing your problem should be the first thing you assume, in general. one thing about BG jobs is that since work is being done asynchronously, sometimes you can do work in a job and have another job fire off in the middle of the first job...so that 2nd job doesn't entirely have the same state as the first one.
[17:18:06] tubbo: Scriptonaut: to debug this, i'd start with the debugger or pry. throw a `binding.pry` line right before the error happens and check the import object. is it nil?
[17:18:17] Scriptonaut: hmm, according to the traces I've printed, they're happening one after the other (though I guess I shouldn't rely on that)
[17:19:16] tubbo: Scriptonaut: have you actually stepped into this code using a debugger?
[17:19:26] Scriptonaut: I've never used a debugger in rails
[17:19:28] Scriptonaut: I don't even know how
[17:19:43] tubbo: Scriptonaut: traces are for chumps! just do `require 'debug' ; debugger` wherever you want the debugger to start working, then when you get to that line it will open a console.
[17:19:55] tubbo: you may have to type `fin` until you get to the line of code that you're *actually* working in. pry is much better for this fwiw.
[17:20:23] tubbo: it's pretty nice, basically an irb with all the state of that particular run of your code. so you can inspect objects and poke around to see exactly *what* is causing the problem.
[17:21:06] tubbo: Scriptonaut: though as many people have said before me, the use of a debugger could be considered a code smell...writing tests is a much better way of figuring out problems if possible, but of course that's not always possible.
[17:22:22] Scriptonaut: alright, so I'll checkout pry
[17:22:25] NBarnes: So, I have rake tasks that I'm trying to run in the context of a Rails application. So I need them to be able to interact with my Rails models and my database. How do I set them up to have access to the execution context of my Rails app? (assuming that the question makes sense >_< )
[17:22:39] NBarnes: pry is all that is a good and right in the world. pry is light. pry is love.
[17:23:06] Scriptonaut: is the learning curve steep?
[17:23:08] Scriptonaut: I'm incredibly lazy
[17:23:16] Scriptonaut: but I need to get this damn feature out yesterday
[17:23:23] NBarnes: pry is stupid easy.
[17:23:33] NBarnes: It's one of pry's good features.
[17:23:44] NBarnes: It's just irb in the context of the code's execution.
[17:23:51] tomengland: beauty of gems.
[17:24:51] tubbo: it's funny, you'd think pry should just be irb
[17:24:58] tubbo: in reality, irb can do everything pry can do. it's just harder to figure out.
[17:25:29] NBarnes: pry does much of the annoying hard work of importing everything. In that sense, it saves me hours of typing in require statements. :P
[17:36:32] Scriptonaut: ok...so I installed pry, but I can't run pry from the command line
[17:37:00] Scriptonaut: oh had to restart console
[17:38:10] Scriptonaut: will pry make my life way better or something? I'm getting excit3d
[17:41:27] tbuehlmann: it made mine better
[17:51:24] smathy: Ahh "re" - nice and old school.
[17:54:00] corehook: who can help me with rubymine ? i have little issue
[17:54:09] corehook: Today my first experience with him , before i used sublime text 3. My os Mac OS. I used cmd+d key to remove right symbol, like 'delete' in windows. How and where i can bind 'delete' button in rubymine ?
[17:55:08] drale2k: Currently i link with "user_root_url(subdomain: @site.subdomain)" but now i need to add a second subdomain (staging) dependent on the Rails env. How can i do this ?
[17:56:39] corehook: fixed route ?
[17:56:46] corehook: before subdomain rule
[17:58:54] liquid-silence: quick question guys, Im rendering a order partial, for each order in the system, each one of them has a pie chart in them using flot, how can I pass the order in question to the javascript?
[18:01:03] mwlang: liquid-silence: you???ll have to show some code as there???s a number of ways to do it. The way I like to do it, though is add the order id as an attribute on the div or html container that holds the pie chart then read it???s value from the JS side.
[18:01:10] corehook: as you render partial ?
[18:01:54] corehook: mwlang, i think it's not rails way to pass data over dom ?
[18:02:29] corehook: told guy than used in last week self.store_id = $("#store_id").val()
[18:02:45] mwlang: corehook: how is it not the Rails way? It???s the unobtrusive JS way. :-p
[18:03:18] Scriptonaut: anyone know why when I do this in pry, it's giving me an error? gist-method s.each_line, where s is a stirng
[18:03:29] NBarnes: What's the error?
[18:03:50] Scriptonaut: SyntaxError: unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
[18:04:44] NBarnes: try exiting from any blocks you might have gotten into in pry. irb/pry sometimes doesn't communicate clearly when you're inside a block.
[18:04:52] aep: is there a simple way of caching something for the duration of a request?
[18:05:42] Scriptonaut: same error after restarting pry
[18:05:53] NBarnes: arp; Session object?
[18:05:56] corehook: ?????? ????????????
[18:06:02] NBarnes: Scriptonaut; gist the code?
[18:06:17] Scriptonaut: there is no code
[18:06:21] Scriptonaut: i'm literally just in the pry console
[18:06:29] Scriptonaut: and typed: gist-method String#each_line
[18:06:30] corehook: screen shot xD
[18:06:35] NBarnes: what is gist-method?
[18:06:38] NBarnes: I don't know it.
[18:07:12] Scriptonaut: hmm, well it looks like I don't have a gist method, I must have a different version than this guy has: http://pryrepl.org/
[18:07:24] corehook: bower-rails amazing gem
[18:07:34] Scriptonaut: gah, so far this stuff is not that eays
[18:08:17] Scriptonaut: tubbo, you were telling me to use a debugger. Now that i have pry, what exactly should I be testing?
[18:10:06] NBarnes: Script; pry should let you inspect your code and variables at the point of insertion. So you can double check your variables for correctness.
[18:10:15] NBarnes: And execute arbitrary code and observe the results.
[18:10:34] NBarnes: Including, if you wanted, the next lines in your execution and see what happens.
[18:12:35] Scriptonaut: save! should complain if it doesn't save right?
[18:12:51] NBarnes: I haven't retained the difference between save and save!
[18:13:14] Scriptonaut: Ok, I located a rollback (I think this is the issue). What's a good way to find out the reasons for a rollback?
[18:14:05] NBarnes: A rollback? I don't think I know of such a thing in the Rails context.
[18:14:21] Scriptonaut: like a database rollback
[18:14:33] Scriptonaut: something didn't workout so the changes were reversed in the db
[18:14:34] NBarnes: Yeah, I know the abstract meaning. Just not a capital-R Rollback.
[18:14:46] NBarnes: I think I see it. SOmething is not working in your save, perhaps?
[18:14:52] NBarnes: Esp since you were asking about save vs save!
[18:14:59] smathy: TIL gist integration in pry
[18:15:12] Scriptonaut: toady I learned
[18:15:13] smathy: Today I Learned
[18:15:29] NBarnes: Ah, yes, Rollback is an ActiveRecord exception.
[18:15:32] smathy: Very cool.
[18:15:47] NBarnes: I assume that save! tossed it at you. Doe sit have a message on the inside?
[18:17:30] Scriptonaut: sweet, gonna wrap that shit in a begin/rescue
[18:17:41] Scriptonaut: it doesn't crash though, it doesn't even error, wtf
[18:25:05] weaksauce: Scriptonaut likely a validation error
[18:25:53] cleopatra: hello who have had that error
[18:26:14] cleopatra: /usr/local/lib/ruby/gems/2.1.0/gems/byebug-3.5.1/lib/byebug/history.rb:1:in `require': cannot load such file -- readline (LoadError)
[18:27:21] hnanon: for a has_many through relationship, does the the "through model need to be included in accepts_nested_attributes_for for a nested form?
[18:30:04] liquid-silence: mwlang https://gist.github.com/jeanres/29340add216cda7d5ba5
[18:30:05] webdestroya: hnanon: not sure. have you tried it?
[18:30:17] liquid-silence: gist for the pie chart question
[18:31:11] siaW: what is the difference in add a gem to the gem file and installing the gem through the terminal? do i have to do both or just one method is enough?
[18:31:28] liquid-silence: because if you do it though a terminal
[18:31:46] liquid-silence: it will not auto install with bundler on heroku or your other hosting
[18:32:03] liquid-silence: mwlang so I have two choices
[18:32:07] weaksauce: siaw gem file and bundler will manage dependency resolution all at once.
[18:32:19] liquid-silence: 1. fetch the orders via ajax, render partial in the js
[18:32:22] Scriptonaut: weaksauce, no validation error
[18:32:24] hnanon: webdestroya: yes, and other variants. I can't get my form to save everything correctly.
[18:32:27] liquid-silence: 2. dont use charts
[18:32:30] Scriptonaut: and now that I've investigated a bit, it doesn't rollback, it commits
[18:32:47] hnanon: I need some insight on how to understand it conceptually.
[18:33:09] weaksauce: mwlang otherwise you can get into a situation where one gem installs something requiring version x and you need version y where x >> y and the two are incompatible
[18:33:13] liquid-silence: hnanon paste the code
[18:33:14] siaW: weaksauce: what if i do install the gem through the terminal like ???germ install better_errors???
[18:33:26] siaW: won dependencies matter?
[18:33:32] webdestroya: you should wash your hands after that
[18:33:37] liquid-silence: siaw it is a bad idea
[18:33:48] liquid-silence: don't mess with that
[18:34:02] siaW: liquid-silence: so i have to always use the gem file and do bundle install?
[18:34:03] liquid-silence: use the gem file
[18:34:13] siaW: and when i use the gem file
[18:34:15] mwlang: liquid-silence: can the data series be rendered to HTML? A lot of chart libraries take a <div> with comma separated data points and turns that into a chart.
[18:34:28] weaksauce: siaw use bundler even for small scripts. and I prefer to bundle install into a subdirectory of the script/project that I am working on
[18:34:32] webdestroya: use the gemfile, and just put better_errors in the development section. thats why there are sections in the gemfile
[18:34:34] siaW: to install gems, it means those gems are installed ON MY computer locally right?
[18:34:54] mwlang: liquid-silence: then you have data to show the user (which you can style up) when no chart is rendered because the user turned off JS and you don???t have to fetch orders ajax-style.
[18:35:13] weaksauce: Scriptonaut so what's wrong then?
[18:35:22] webdestroya: i think now handling "non js users" is not really something you should worry about
[18:35:27] mwlang: weaksauce: sorry, I???m not sure what you???re referring to???
[18:35:30] webdestroya: you should just put something that says "get js you bum"
[18:36:00] Scriptonaut: weaksauce, my model isn't saving
[18:36:11] Scriptonaut: even though the console says it's committing
[18:36:19] Scriptonaut: when I reload, it reloads the old objects
[18:36:45] weaksauce: gist some console output Scriptonaut?
[18:36:45] Scriptonaut: here's the code if you're curious: https://gist.github.com/robins35/515f4658d233811f97ff
[18:36:55] Scriptonaut: let me get console output
[18:37:02] jumz: Greetings
[18:37:20] siaW: i think if i do ???git -am ???message??? i don???t need to do ???git add .??? am i right?
[18:37:47] hnanon: liquid-silence, webdestroya: https://github.com/hnanon/alog/tree/master/app
[18:38:37] liquid-silence: mwlang sorry african' DSL
[18:38:39] jumz: Is anyone using store_accessor in rails 4? I'm trying to use it but I'm getting the following error when trying to save a record that has a store accessor assigned: http://cl.ly/image/132S0D341W3F
[18:38:56] liquid-silence: I'm not 100% sure if flot can do this
[18:39:13] jumz: I"m looking at the quoting class and it doesn't seem to know what the column type is: http://cl.ly/image/1G3X2F241V01
[18:39:22] liquid-silence: unless I drop two hidden fields on the page and iterate over each .donut or something
[18:40:46] liquid-silence: mwlang any other ideas?
[18:42:25] Scriptonaut: here ya go weaksauce
[18:42:26] liquid-silence: mwlang this is the chart I am using (customized pie chart) https://www.dropbox.com/s/2snbi5yd1lzyiz1/Screenshot%202014-11-11%2020.42.10.png?dl=0
[18:42:29] Scriptonaut: https://gist.github.com/robins35/db411e1b5969991fe4f6
[18:42:57] Scriptonaut: The console output is from around lines 72 to 82
[18:44:53] mwlang: liquid-silence: I was just looking through the flot docs. It doesn???t really lend itself to what I suggested.
[18:45:20] liquid-silence: so the other option will be to render the partial from the JS?
[18:47:05] mwlang: liquid-silence: well, one way to do it is to build the call to the chart initializer in the html
[18:47:26] mwlang: basically, construct the JS inline.
[18:47:42] liquid-silence: in script tag in the partial?
[18:47:45] mwlang: its not as unobtrusive, but certainly effective way.
[18:48:43] weaksauce: Scriptonaut put a binding.pry at the top of the file and step through the code to see where it adds to the error_rows
[18:49:01] liquid-silence: ACTION cries inside
[18:49:20] weaksauce: at each step check the variables to make sure they are what you expect them to be at all points
[18:50:25] mwlang: liquid-silence: may not be as ???elegant??? but gets the job done and as long as its well-structured from maintainability standpoint, should fly.
[18:51:45] Scriptonaut: how do I step?
[18:52:31] Scriptonaut: I type step and it says: undefined variable step
[18:52:45] weaksauce: believe it's next
[18:54:31] Scriptonaut: Syntax error: can't escape from eval with next
[18:55:08] Scriptonaut: there should be a step command too
[18:55:15] Scriptonaut: I feel like my version of pry is fucked up or something
[18:55:35] Scriptonaut: I have version 0.10.1
[18:58:47] liquid-silence: mwlang how would I access the local order variable in that JS?
[19:00:26] liquid-silence: because aparently
[19:00:45] liquid-silence: { label: "Used", data: '<%= order.account_logs.last.usage.to_f %>', color: '#a4df11' },
[19:00:50] liquid-silence: this does not seem to work
[19:03:28] Scriptonaut: weaksauce (or anyone elser willing to help). checkout this pry: https://gist.github.com/robins35/3c4187cdb8bae5b23959
[19:03:39] mwlang: liquid-silence: that should work.
[19:03:49] Scriptonaut: see how I show import_obj, it has error_rows
[19:03:55] Scriptonaut: then I save it
[19:03:56] liquid-silence: never mind I was being a idiot
[19:04:37] Scriptonaut: (on line 31). Then I show it, still has the error_rows. Then I reload it (line 56), then I show it, and it has lost error_rows
[19:08:52] owen1: i deleted the log/test.log file and i don't see it re-generated. is there a way to bring it back somehow?
[19:09:00] owen1: i tried touch test.log but it didn't hep
[19:09:13] Radar: owen1: Re running your tests should regenerate it.
[19:09:48] owen1: Radar: hi man! how is the new startup going
[19:10:04] owen1: i am rerun it with this command: spring rspec spec/controllers/admin/accounts_controller_spec.rb:37 but it's not coming back
[19:10:07] Radar: owen1: hi :) It's going well
[19:10:14] philcrissman: Radar: new startup? o_O Not at Spree?
[19:10:26] philcrissman: ACTION lives under a rock
[19:10:34] Radar: philcrissman: owen1: I don't use Spring
[19:10:37] Radar: http://ryanbigg.com/2014/07/ryan-bigg-is-now-a-git/
[19:10:46] Radar: owen1: I don't use Spring so I don't know what is happening there
[19:10:52] Radar: owen1: what happens if you try without spring?
[19:10:53] owen1: i'll try removing it
[19:12:02] mekhami: is like everyone here at Spree? lol
[19:12:41] owen1: Radar: works!
[19:17:05] philcrissman: mekhami: there are others at Spree? I just knew Radar was (previously).
[19:21:48] cleopatra: hey anoye had that problem ? https://gist.github.com/anonymous/03b5edac96d48e0c0b43#file-gistfile1-rb
[19:22:25] cleopatra: sorry wrong url https://gist.github.com/ArpiaPsuv/ff3106ee6a151ac4486c
[19:24:02] weaksauce: Scriptonaut is error_rows an actual db column?
[19:24:16] tubbo: Radar: that lifx thing is pretty neat. are they like CFLs?
[19:27:44] weaksauce: tubbo led it looks like
[19:28:10] weaksauce: interesting concept... stiff price
[19:28:56] tubbo: how much are those lamps normally? my friend has one next to her bed and there's a remote control you can use to play with the colors and animation
[19:28:56] weaksauce: cleopatra try bundle exec rails s
[19:29:04] tubbo: this is basically the same thing, except no lamp and you control it with an app
[19:29:11] weaksauce: or actually not. bundle exec rails g controller main
[19:29:16] wmoxam: https://gist.github.com/wmoxam/4db846978b6e2c969bdd
[19:29:27] cleopatra: weaksauce, no work already i uninstall that vercion ill check in deep
[19:29:33] wmoxam: I guess delegate doesn't work well with STI?
[19:40:53] rhizome: it doesn't appear that the inheritance flows through associations like that
[19:41:22] tubbo: bet if you did it "manually" (like actually redefined the method) it would work though
[19:41:29] rhizome: you could probably do some funky introspection, but...meh
[19:41:43] Scriptonaut: weaksauce, ya it is
[19:41:49] wmoxam: it's actually a spelling error
[19:41:53] Scriptonaut: error_rows isn't the only column that doesn't write, none of them do
[19:42:18] Scriptonaut: any changes I make to import_obj in the delayed job don't actually write to the db
[19:42:45] Scriptonaut: even though in the console, I see the sql update statements, and see them return true. I'm so mindfucked I've never seen anything like that before
[19:42:52] tubbo: wmoxam: nice
[19:43:12] tubbo: i hate the way "removable" is spelled
[19:43:15] tubbo: also "cancelable"
[19:45:12] wmoxam: tubbo: I just need to remember that if the world seems crazy I've probably made a spelling mistake
[19:46:08] Scriptonaut: https://rails.lighthouseapp.com/projects/8994/tickets/6666-save-activerecordpersistence-can-return-true-even-when-the-model-is-not-saved-and-seems-to-break-the-principle-of-least-surprise
[19:46:12] Scriptonaut: I wonder if this could be happening to me
[19:46:55] rhizome: maybe reload
[19:47:19] Scriptonaut: it reloads the object before I even entered the job
[19:47:29] Scriptonaut: ie, a fresh object without any errors
[19:48:50] dstarh: is there any way to render single sass file from a controller?
[19:49:27] tvon: Does anyone know in what gem the 'db:seed' task is defined?
[19:49:29] dstarh: We have a font sass file that another application needs to share and we need to access the compiled file outside of application.css
[19:49:44] weaksauce: can you create an import record from the rails console Scriptonaut?
[19:49:51] tvon: or db:test:prepare for that matter
[19:49:59] weaksauce: manually and then update it and save it and then reload it
[19:50:16] mekhami: https://gist.github.com/mekhami/9b0b5324f36ecf4807d9 i'mt rying to figure out why generate_for is returning 3 for the today and yesterday case. it should be returning numbers in the thousands. i assume it has something to do with line 26...
[19:50:18] elaptics: dstarh: if you've made sure it's getting precompiled then you can include it in the views that you need
[19:50:31] dstarh: I've tried render text: Interface::Application.assets.find_asset('fontello.css') and many variations of that
[19:50:41] Scriptonaut: weird, binding.pry only works when I do it in a background job
[19:50:50] Scriptonaut: not in normal methods
[19:50:56] dstarh: elaptics i need to render the generated text, not the css file within a template
[19:51:05] Scriptonaut: weaksauce, yep
[19:51:16] elaptics: dstarh: I'm not sure I understand what you want to do then
[19:51:37] dstarh: i want to go to myapp.com/font and have that return css
[19:51:44] dstarh: and only css
[19:52:06] elaptics: dstarh: and that css needs to be dynamic?
[19:52:50] dstarh: no the sass that was compiled at render time is fine, but I don't want the rest of the css, only what's defined within font.css.sass, nothing else that's in application.css
[19:53:02] tvon: ACTION just found `rake -W`
[19:53:05] dstarh: gah, not at render time, at precompile time
[19:53:39] elaptics: dstarh: can't you just separately precompile the font sass file then so it's a separately available asset?
[19:53:50] rhizome: dstarh: manifests
[19:53:52] elaptics: just by adding it to the precompile list
[19:54:14] dstarh: hrm that might be doable, just a separate manifest
[19:56:14] Scriptonaut: I'm having trouble making a new Import object, because for some reason I can't just go: File.new("~/Downloads/file.csv")
[19:56:24] Scriptonaut: it says it doesn't exist (but I'm looking at it)
[19:57:01] tubbo: Scriptonaut: File.new takes an absolute path, to convert your relative path to an absolute path, use File.expand_path
[19:57:15] tubbo: Scriptonaut: so that should be File.new(File.expand_path('~/Downloads/file.csv'))
[19:57:19] Scriptonaut: isn't ~/Downloads/blah an absolute path?
[19:58:21] weaksauce: Scriptonaut no it's got the home shortcut ~
[20:00:04] Scriptonaut: this is so damn weird
[20:00:21] weaksauce: Scriptonaut it's likely because you are using delayed_job
[20:00:31] Scriptonaut: weaksauce, I'm recreating this without delayed job
[20:00:51] Scriptonaut: in the console, It lets me create a new Import, I give it the necessary params and save it fine
[20:01:15] Scriptonaut: then I modify it a bit by changing things like error_rows, error_count, complete, etc. and save it, it saves fine, but then when I reload it, it reloads the initial one
[20:02:20] weaksauce: curious. no idea then
[20:02:46] Scriptonaut: ok, I have noticed something. It will not save attributes that aren't "attr_accessible"
[20:02:53] Scriptonaut: it says it does, but it doesn't
[20:03:11] weaksauce: what version of rails?
[20:03:31] Scriptonaut: it also saves things that I validate for presence
[20:05:49] tubbo: Scriptonaut: yeah, you can't mass-assign attributes that aren't in the attr_accessible whitelist
[20:06:06] Scriptonaut: tubbo I wasn't mass assigning
[20:06:28] Scriptonaut: I just do: nim = Import.new(:csv => myfile)
[20:06:36] Scriptonaut: nim.uploader_id = User.last.id
[20:06:41] Scriptonaut: nim.save (this all works)
[20:06:52] Scriptonaut: after that though, anything I save isn't persistant
[20:07:00] tubbo: Scriptonaut: if it's coming from form params, that's when attr_accessible comes into effect
[20:07:01] weaksauce: oh yeah. I think the rails 3 way is to use attr_accessible for your columns. is this an existing app or something new?
[20:07:37] Scriptonaut: this is an existing app, in fact this is the last bug of the last feature before I start working on the next version (rails 4, and a lot of other good shit I can't wait to use)
[20:07:43] tubbo: weaksauce / Scriptonaut - this is the gem that provides this functionality in rails 4. it also includes a usage guide that may shed some light onto your problem. https://github.com/rails/protected_attributes
[20:16:28] mekhami: anyone got time to help me fix the little error i posted above? ;) love you long timee
[20:17:20] mekhami: not an error per se, just returning the wrong value
[20:21:43] tvon: If rake task :foo depends on task :bar, and :bar loads :environment, one can assume that :foo doesn't need to explicitly load :environment..?
[20:21:46] Scriptonaut: I found the fuckin error
[20:21:58] Scriptonaut: I have: after_initialize :init
[20:22:18] tubbo: after_initialize sucks so muc
[20:22:31] Scriptonaut: what should I use to initialize error_count to 0 and not nil?
[20:22:33] Scriptonaut: it's an integer
[20:22:34] omosoj: can you create a record with patch, or only possible with post?
[20:22:36] dllama: i'm getting an error when adding delayed_job to capistrano that it cannot load delayed/recipes. can anyone suggest of where i can update that so that it takes the recipe from the gem?
[20:22:54] tvon: I ask becuase the db:seed task does not depend on :environment, but it seems like it should... it does however invoke another task that does depend on :environment. I want to make sure I'm reading things right.
[20:23:42] tubbo: tvon: you're correct, if the task it depends on depends on environment, then it will take that up
[20:23:54] tvon: tubbo: okay, thanks
[20:24:02] tubbo: tvon: the reason is because rake evaluates "dependent" tasks from the outside in. so any task your task depends on gets run before your task.
[20:24:07] tomato_omelette: Is there a general rule of thumb for how many Unicorn workers to set up on a VPS based on the VPS' memory/cpus?
[20:25:23] mekhami: http://dpaste.com/2QEZADC this is the code i have to work with lolol
[20:25:50] slash_nick: very 'stream of consciousness'
[20:26:01] mekhami: look at that indentation
[20:26:06] mekhami: how does anyone write this crap
[20:26:08] weaksauce: Scriptonaut one way is to or equals it to 0 any time you use it
[20:26:37] weaksauce: or do that in the init method
[20:26:59] weaksauce: self.error_count ||= 0
[20:27:56] tvon: tubbo: if multiple dependant taks overlap, will it evaluate them twice? Eg, if `:foo => [:environment, :bar]` and `:bar => :environment` will :environment get hit twice or is it smart enough to figure that out?
[20:28:04] tvon: I'm guessing the latter.
[20:30:11] omosoj: can you create a record with 'patch'?
[20:30:24] omosoj: or only with post?
[20:32:44] tvon: omosoj: semantically speaking, you should only use patch to update a record
[20:33:20] Scriptonaut: http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV.html#method-c-parse
[20:33:30] Scriptonaut: can I pass parse: :headers => true?
[20:33:33] Scriptonaut: it doesn't seem to give a crap
[20:34:53] weaksauce: yes Scriptonaut
[20:35:03] omosoj: tvon, is there a verb that will update a record, but if a record doesn't exist, creates one?
[20:35:06] weaksauce: http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV.html#method-c-new
[20:35:13] weaksauce: all of those options are valid
[20:35:28] iamjarvo: Hi all, I am getting this error "<Hash> {:error_object=>#<TypeError: wrong argument type Symbol (expected String)>" when trying to go from rails 4.0.10 to 4.1.5. If i change the symbol value to a string value it works. I am trying to figure out what changed and when. i tried looking at the diffs on github but nothing stood out
[20:35:40] Scriptonaut: Well when I pass it: :headers => true, it still gives me a damn header
[20:35:52] MattB2: omosoj: find_or_create?
[20:35:56] Scriptonaut: it should stript out the headers right? It's treating the headers like any other row
[20:36:25] tvon: omosoj: PUT will create or update
[20:36:44] tvon: I believe...
[20:37:28] tvon: I'd do some googling, but PUT should (I think) create or *replace*
[20:38:14] omosoj: tvon, looks like you're right, according to w3.org. just gotta make sure rails behaves this way. thanks!
[20:38:54] omosoj: MattB2, that logic would need to be in the controller, right?
[20:39:25] MattB2: omosoj: yes, sorry, joined the conversation late so getting a bit ahead :-)
[20:41:25] tubbo: tvon: it just updates in rails
[20:41:32] omosoj: MattB2, np, thanks for your help. i'm building features on an api and it looks like a lot of these functions don't require controller logic, so i guess i'm trying to handle everything with REST
[20:41:38] weaksauce: Scriptonaut yes. just tried it on my system. not sure if your version of the stdlib is old or not though
[20:41:53] tvon: omosoj: ^^ what tubbo said
[20:41:54] tubbo: omosoj: PUT *should* do that (PATCH would be theoretically just an update), but rails lumps PATCH & PUT together by default.
[20:42:19] cleopatra: weaksauce, already fix
[20:42:22] tubbo: omosoj: you can override that and define your own `put` route i believe, that will do an update_or_create maybe
[20:43:02] omosoj: tubbo, did you see MattB2's suggestion? is it better to somehow route it to the controller and do find_or_create?
[20:44:16] omosoj: oh, hm, i think that's what you're suggesting
[20:45:17] hnanon: I've been toiling with this deep nested form for two days.
[20:45:37] hnanon: The join table is saving new instances of the objects.
[20:45:53] hnanon: Instead of referencing existing objects.
[20:46:13] liquid-silence: why do people build API's that return data that cannot be parsed
[20:46:26] liquid-silence: http://pastie.org/private/8nqyheydb9ygyxbqpwxtq
[20:46:40] liquid-silence: how the fark am I supposed to get that in tabular data
[20:46:44] webdestroya: liquid-silence: that is a CSV
[20:46:46] tercenya: liquid-silence: same reason people ask questions that can't be answered in IRC
[20:46:51] webdestroya: so, thats pretty parsable
[20:47:16] liquid-silence: how did I miss that
[20:47:23] liquid-silence: except that it has many []
[20:47:41] webdestroya: maybe find/replace them first?
[20:47:45] hnanon: My models: https://github.com/hnanon/alog/tree/master/app/models (see product, option, product_option, and variant).
[20:48:01] webdestroya: it looks like a CSV designed by someone who has seen only a portion of a CSV
[20:48:15] webdestroya: so, it might take some fixing, but it shouldnt be too bad
[20:48:49] liquid-silence: each array is a CSV line
[20:50:47] Scriptonaut: I keep reading liquid-silence as liquid-sauce
[20:51:05] liquid-silence: im gonna loose my tits with this
[20:51:11] webdestroya: fun fact, most sauces are in fact liquid
[20:51:21] liquid-silence: webdestroya I can do gsub ']', '\n'
[20:51:27] Scriptonaut: I want to wash large pieces of char-broiled meat down my gullet with teriyaki sauce
[20:51:28] liquid-silence: but CSV.parse tells me to sod off
[20:51:45] webdestroya: liquid-silence: look at the output, and see if it looks right
[20:51:54] webdestroya: what happened to the [
[20:52:18] webdestroya: you have pairs of ][ and you replaced ] so now you have \n[ which CSV will rightly yell at you for
[20:52:19] liquid-silence: oh I removed that
[20:52:40] liquid-silence: request.body_str.gsub('--START--,', '').gsub(',--STOP--','').gsub('[', '').gsub(']', 'n')
[20:52:42] webdestroya: do your replaces, and then post the new file
[20:52:42] liquid-silence: horrible I know
[20:52:56] webdestroya: n is not \n, and '\n' is not "\n"
[20:53:07] liquid-silence: it does not parse as CSV
[20:53:17] webdestroya: gist your outputed CSV file
[21:03:39] SloggerKhan1: If I've got an object and want to know whether another object's collection includes it, what's the best way of checking? IE "do.his.items.include? my_item" essentially. Assuming both have been fetched already.
[21:04:06] SloggerKhan1: And by object I mean an active record object.
[21:08:14] SloggerKhan1: Ah, it has an include? method after all.
[21:09:50] blitz: is there an alternative to God for monitoring nginx-passenger installs?
[21:11:02] tubbo: blitz: we used to use monit, now we use upstart and nagios.
[21:11:10] tubbo: upstart keeps processes alive, nagios gives us alerts.
[21:11:44] blitz: yes, I should look into using upstart since we're having issues with god moving to 14.04
[21:13:22] tubbo: blitz: honestly the linux world seems to be moving to systemd...i would say that's a better use of your time
[21:13:36] tubbo: i'm pretty sure systemd also does process keep-alive stuff
[21:15:02] blitz: I think 14.04 is some kind of ugly systemd-upstart hybrid
[21:15:24] blitz: I think you can switch over to systemd though
[21:17:37] uberjar: you could always just take the bluepill and forget about god, but I don't recommend it
[21:18:14] uberjar: https://github.com/arya/bluepill
[21:18:27] billy_ran_away: I'm switching database backends and am interested in benchmarking the two against each other. Any ideas or suggestions?
[21:18:29] tubbo: blitz: well what i mean is that by the next LTS release, upstart is not going to be default anymore.
[21:18:34] blitz: I did find bluepill, it looks bare though
[21:18:35] tubbo: blitz: so you might as well learn systemd
[21:18:51] tubbo: bluepill is over-complicated. i'm not sure what the point of runit is. ;)
[21:19:02] blitz: it would be nice to have something that we wouldn't need to completely abandon on next LTS
[21:19:25] blitz: oh bluepill moved
[21:20:11] blitz: bluepill looks just like god
[21:36:12] Radar: tubbo: They're even better than CFLs.
[21:36:22] Radar: tubbo: They're $99 currently.
[21:38:05] tubbo: looks neat
[21:38:15] tubbo: Radar: i assume that app has a whole API i can screw around with as well? :)
[21:38:47] Radar: Not yet, we're changing our protocol around at the moment and once we're done with that we'll be releasing some libraries.
[21:39:05] dangerousdave: Would there happen to be a German here who wouldn't mind checking a google translation for me please?
[21:41:40] hnanon: Radar: Do you mind taking a look at what I got to see why form data is not saving correctly?
[21:41:58] Radar: hnanon: did you override save again?
[21:42:24] Radar: Or was that someone else yesterday?
[21:42:30] webdestroya: i think that was someone else
[21:42:38] hnanon: Radar:wasn't me
[21:42:52] Radar: hnanon: code plz
[21:43:12] hnanon: Is a repo ok?
[21:43:15] hnanon: https://github.com/hnanon/alog/tree/master/app/models
[21:43:35] Radar: hnanon: repo is fine
[21:43:36] hnanon: models of note: product, option, product_option, variant
[21:43:51] Radar: hnanon: what is not saving where?
[21:43:58] Radar: https://github.com/hnanon/alog/blob/master/app/models/product_options.rb
[21:44:01] Radar: Why does this file exist?
[21:44:10] hnanon: Using the cocoon gem for nested attributes fields
[21:44:38] hnanon: Hmm. It shouldn't
[21:45:35] Radar: hnanon: so where is it going wrong?
[21:45:51] hnanon: It doesn't exist locally.
[21:46:10] Radar: hnanon: So when posting about these issues, please provide people with a list of steps to reproduce the issue.
[21:46:20] hnanon: The form is creating new options and products in product_option
[21:46:24] Radar: Great way to do that because your code is open source is to post an issue on your repo about it and then link people to it
[21:46:25] Radar: Which form?
[21:46:36] hnanon: It should just reference products and objects there, right?
[21:47:40] hnanon: Radar: https://github.com/hnanon/alog/blob/master/app/views/products/_form.html.erb
[21:52:47] blitz: what are the pros and cons of haml vs erb
[21:53:08] xibalba: any gem recommendations for storing and working with DateTime schedules
[21:54:01] xibalba: nm found a section on ruby-toolbox
[21:56:46] rubyonrailed: Hey, i'm trying to show a json error message in my alert, but my message doesn't seem to be passing in correctly. It's only showing "Failure" `return render :json => {:success => false, :message=>"Error with your login or password"}, :status=>401`
[22:05:18] joelbrewer: hey guys, question about API security: I'm building a Shopify application that has a Rails backend and a javascript frontend. The javascript frontend is in the form of a widget that is displayed when a customer visits a merchant's store. I would like to post to my backend whenever the widget is displayed, which would involve a POST from the widget javascript code. However, that would require openin
[22:05:24] joelbrewer: g my API up to allow POSTing to a particular endpoint, which doesn't seem secure, unless I require a token of some sort. However, I don't want users to have to login to use the widget...
[22:06:54] joelbrewer: How should I go about authenticating my javascript frontend widget with my backend API?
[22:07:16] joelbrewer: (without requiring a password/username)
[22:07:29] tubbo: joelbrewer: authentication token in the http header
[22:10:18] uberjar: joelbrewer, there's no good way to do it, if I understand your question correctly
[22:10:31] joelbrewer: tubbo: how can I use that to authenticate on the client-side? Wouldn't I need to put the token in the javascript?
[22:10:53] CLassala: Hi all! I'm setting up my RoR dev env on a new Mac, but can't figure out why it is not accessing my mongodb. I have the mongoid.yml configure exactly like I have it on another working machine, but on this new I don't get my app to access the correct database. Is there anyway for me to check on rails console what database it is using?
[22:12:26] rikkipitt: evening guys, has anyone managed to use active_model_serializers with ancestry and return a nested json object?
[22:12:48] uberjar: joelbrewer: you're not going to be able to gaurintee that it's your javascript client making the request and not some malicious client
[22:13:27] uberjar: CLassala: sorry.. there's not a ton of mongo users in here
[22:13:37] uberjar: CLassala: check out mongomapper documentation
[22:13:51] tubbo: joelbrewer: your JS would have to know the token and pass it with each request back to the server
[22:14:30] joelbrewer: tubbo: okay. that makes sense, but wouldn't that make the token publically available? (if JS knows it?)
[22:14:37] CLassala: I'm using Mongoid (instead of mongomapper)... I'll look it there again and see if I missed something... this issue is driving me nuts...
[22:14:44] uberjar: joelbrewer: that's why it won't work.. yes
[22:15:34] joelbrewer: uberjar: what would you do in this situation?
[22:15:55] uberjar: joelbrewer: I don't know enough background about your problem domain, what you're trying to accomplish
[22:16:18] joelbrewer: uberjar: Alright, I'll try to clarify.
[22:16:20] uberjar: joelbrewer: login/password auth is probably a good way to do anything that needs real security
[22:16:40] rikkipitt: arrange_serializable helps with ancestry and active model serializers
[22:16:44] rikkipitt: to answer myself
[22:16:53] tubbo: the way i solve this when working with long-living apps, like when you make an app with ember.js, is by simply using the session
[22:16:55] tubbo: which you can do
[22:17:24] tubbo: just let the server handle authentication and disable the ember app on the static login pages. sure, it's not the *whole* app in ember but who cares
[22:19:17] joelbrewer: tubbo: argh. maybe I'm dense (or just green), but I don't understand how to make your solution work for my use case.
[22:21:03] tubbo: joelbrewer: might be a slightly different use case. you're using a widget on an existing regular html site, i made a whole single-page app from scratch and never served html from the server.
[22:21:37] tubbo: joelbrewer: what *exactly* does this widget do? does it just track users on the shopify site?
[22:21:42] tubbo: is this basically a tracker png?
[22:22:05] tubbo: if it's just sending like analytics/usage data back to your app i don't see why it needs to be authenticated at all...
[22:23:26] seahawks7: lots more people on the channel
[22:23:35] joelbrewer: tubbo: basically yeah. It's a widget that is displayed to visitors, allowing them to complete various social media tasks (Facebook, Twitter, etc) and then sends that data back to the server
[22:24:07] seahawks7: anyone here in Seattle, if so, any plans on attending the rails meet up event next week?
[22:24:10] tubbo: joelbrewer: that doesn't seem like a really good reason for authentication. i say, make it unauthenticated unless your manager/client yells at you for some reason :P
[22:24:34] joelbrewer: tubbo: Uppon widget load, I want the widget to create a cookie with a hash value and send that data back to the server so we can track that the widget has been loaded
[22:24:41] tubbo: joelbrewer: this is not an unsolvable problem but it's tricky and sometimes annoying, so if you can avoid it maybe that would be better in this case. especially since it's just for one little widget on one little page...
[22:26:04] joelbrewer: tubbo: so you're saying just open up the api to POSTs and don't really worry about authentication? The widget will ultimately be on a number of different websites (whoever installs it from the Shopify app store)
[22:27:12] tubbo: joelbrewer: you don't have to sledgehammer it, the widget doesn't need full write access to your api...
[22:27:31] joelbrewer: tubbo: cool. yeah, all it could do is post data
[22:28:07] tubbo: joelbrewer: so just allow the one post request to be hit without needing authentication, and as long as that request isn't like vital to the success of your app (i'm imagining it's just used for analytics), you should be ok
[22:28:32] joelbrewer: tubbo: yeah, that sounds good.
[22:28:47] joelbrewer: tubbo: thanks for the help :) nice to hear I was overthinking this one.
[22:31:15] Peaker: http://apidock.com/rails/ActiveRecord/Relation/update <-- does this actually silence all errors???
[22:31:38] Peaker: who would do such a terrible terrible thing?
[22:31:46] webdestroya: why is it terrible?
[22:32:06] Peaker: because errors are important -- unhandled errors are quite likely bugs
[22:32:06] webdestroya: its documented, if it works for your use case, great. otherwise, dont use it
[22:32:21] webdestroya: it doesnt say "swallows errors"
[22:32:23] Peaker: well, terrible behavior being documented doesn't cease to be terrible
[22:32:34] webdestroya: its not terrible depending on the usecase
[22:32:50] Peaker: webdestroya: what use case would want to ignore all errors?
[22:33:02] tubbo: Peaker: what are you talking about?
[22:33:05] webdestroya: it doesnt ignore all errors... where are you reading that?
[22:33:14] tubbo: i don't see how it ignores *any* errors
[22:33:24] Peaker: "The resulting object is returned whether the object was saved successfully to the database or not."
[22:33:33] webdestroya: no where does that say "swallows all errors"
[22:33:45] tubbo: Peaker: that doesn't mean errors were swallowed. that's how an ORM works.
[22:33:57] tubbo: Peaker: if you check that_object.errors.full_messages you'll see all the validation errors...
[22:34:09] Peaker: what does returning the object when it was saved unsuccessfully mean, besides swallowing of errors?
[22:34:09] tubbo: Peaker: also...if you have an actual database error, rails will throw some kind of exception.
[22:34:26] Peaker: so it's for schema validation errors?
[22:34:53] tubbo: Peaker: it means exactly what it says. that the object comes back to you, regardless of whether it worked or not. it's for rails validation errors..
[22:34:57] helpa: Peaker: The Active Record Validations Guide - http://guides.rubyonrails.org/active_record_validations.html - Written by Jaime Iniesta
[22:34:57] tubbo: Peaker: !validations
[22:34:59] Peaker: so it only sweeps validation errors under the rug - and not other kinds of errors?
[22:35:54] webdestroya: flexibility and power do not equate to "terrible". read the documentation, and use methods accordingly. we shouldnt suffer less flexibility because a few devs think a certain usecase is "terrible"
[22:35:57] tubbo: Peaker: it doesn't sweep any errors under the rug.
[22:36:41] Peaker: tubbo: well, having to explicitly go to errors.full_messages and look there is kinda like lifting a rug :)
[22:37:19] sinelaw: having an explicit exception would be nice. that's what Persistence.update!
[22:37:43] sinelaw: Relation should have a similar API
[22:37:52] tubbo: you shouldn't be doing Relation.update anyway
[22:37:54] tubbo: it's silly
[22:37:56] seahawks7: actually, yeah, any reason why update! doesn't exist?
[22:38:06] seahawks7: or does it exist in a base class?
[22:38:12] Peaker: if I just naively make a change and use .update -- when update returns I'd expect the object to be up-to-date always, and not just in my single test case. In realistic scenarios, this "update" behavior will result in some successful tests followed by buggy updates not happening
[22:38:15] tubbo: first of all, there's update_all...second of all, why the fuck would you want to just blindly run an UPDATE on your table without verifying its data in the ORM
[22:38:20] sinelaw: the docs don't say that I shouldn't or that it's silly
[22:38:23] tubbo: why are you using an ORM if you're just gonna circumventi t like that
[22:39:04] tubbo: sinelaw: update_all is effectively that, it doesn't really do any verification of the data before attempting to run the query
[22:39:17] sinelaw: that's not the point...if a method exists in the API, it should behave in a reasonable way
[22:39:35] sinelaw: e.g. throw exceptions when errors occur
[22:39:44] sinelaw: like Persistence.update!
[22:39:48] tubbo: just because an error occurs doesn't mean an exception should be raised.
[22:39:59] tubbo: some of us don't like chasing down exception handling
[22:40:05] sinelaw: ok...so return a bool?
[22:40:09] sinelaw: like Persistence.update
[22:40:21] Peaker: tubbo: if an error occurs and the expected effect/semantics of calling that method did not happen, and no exception is raised, then you get a hard-to-chase bug
[22:40:24] tubbo: i dunno, i think that's a dumb method and i wouldn't actually use it :P
[22:40:29] tubbo: (AR::Relation.update)
[22:40:31] seahawks7: wtf is persistence.update
[22:40:47] sinelaw: seahawks7, http://apidock.com/rails/v4.0.2/ActiveRecord/Persistence/update
[22:41:09] Peaker: tubbo: if you call "do_foo" and "foo" was *not* done, do you just return to your caller as if everything is fine?! do you not think this is a sure recipe for disaster?
[22:41:13] tubbo: Peaker: well, if your app handles ActiveRecord errors properly, you don't need exceptions. and exceptions have other unintended side effects that cause debugging pain.
[22:41:21] smathy: sinelaw, you want `update` to work the same as `update!` ?
[22:41:31] helpa: Peaker: The Active Record Validations Guide - http://guides.rubyonrails.org/active_record_validations.html - Written by Jaime Iniesta
[22:41:31] tubbo: Peaker: !validations please read before arguing
[22:41:46] tubbo: i'm sorry but you're just way too uninformed to be debating this right now
[22:42:01] sinelaw: smathy, no, I don't want anything, but I would expect Relation to have an "update!" method and that the "update" one should return a bool
[22:42:11] seahawks7: k, so the lack of update! method in relation, is that the problem?
[22:42:22] sinelaw: seahawks7, more that the existing method is confusing.
[22:42:33] tubbo: Peaker: the way rails works...it makes the error flow here make a lot of sense. might not make sense if you're actually reading the code, but when you actually use rails it makes a lot of sense.
[22:42:49] Peaker: tubbo: that guide basically tells me I have to remember and check the errors manually. If I forget, it does seem like I get bugs
[22:43:01] seahawks7: tubbo: it is a little odd about how "update" is defined in each case though yah?
[22:43:05] seahawks7: er, update/update!
[22:43:16] tubbo: Peaker: well consider that model.save will run validations before trying to persist to the DB...
[22:43:16] smathy: sinelaw, oh right, but the class level methods work differently to the instance methods.
[22:43:19] sinelaw: yes. looks like leftover from old APIs
[22:43:50] Peaker: tubbo: and if the validations fail, model.save will throw an exception?
[22:43:56] tubbo: Peaker: plus, your app SHOULD BE HANDLING ERRORS...you should not be delegating that to ruby or the exception level. e
[22:44:30] tubbo: Peaker: model.save will return false. model.save! will throw an exception
[22:44:36] Peaker: tubbo: exceptions are a nice way to guarantee that error handling is not forgotten anywhere
[22:44:40] tubbo: usually the convention is bang-methods in rails throw exceptions when they fail
[22:44:47] smathy: sinelaw, no, it's current API, it's how class methods work in Rails, they return an instance whenever possible.
[22:45:05] smathy: sinelaw, Rails isn't for everyone.
[22:45:08] tubbo: Peaker: they're also a nice way of ensuring that when a developer tries to debug the code they can't figure out where the error is coming from ;)
[22:45:12] seahawks7: tubbo: agreed, but the lack of same commands in Relation, isn't that odd?
[22:45:39] tubbo: Peaker: exceptions are for "exceptional" errors. errors that aren't supposed to happen, even in normal QA testing. users type in bad data all the time, this should not be an exceptional error case!
[22:45:43] sinelaw: smathy, i'm not talking about the instance vs. class methods. i'm talking about masking errors.
[22:46:09] tubbo: Peaker: for example, typing in an invalid email is not exception-worthy, but the database running out of free space on the hard disk? now that's exceptional!
[22:46:22] smathy: Peaker, that's not true anyway, exceptions are often handled at a higher level and that often hides errors. You're basically just saying that you prefer one risk of hidden errors vs another risk of hidden errors. Truth is that if you don't understand the API and code to it then you can always end up with hidden errors.
[22:46:25] Peaker: tubbo: I understand the philosophy now, though I very much disagree with it.. IMO: Semantics of method should be to actually do what it says it does -- and raise an exception if it didn't
[22:46:54] Peaker: smathy: how would the higher level handling of exceptions hide errors?
[22:46:56] startab: Good afternoon everyone. Anyone with strong SQL skills hanging around?
[22:47:04] sinelaw: Peaker, returning a bool success/fail is also fine
[22:47:24] uberjar: sinelaw: one man's strong is another man's not strong enough
[22:47:27] seahawks7: is there a reason why update doesn't behave like save?
[22:47:35] Peaker: tubbo: regardless of whether it is "exceptional" or not (a subjective idea in any case), the "objective" idea is "did the desired effect actually happen?"
[22:47:46] smathy: sinelaw, well, you're complaining that Relation.update returns an instance, and that you then need to interrogate that instance to see if there were errors. You'd rather it raised an exception which you would then need to rescue and interrogate to see what errors there were.
[22:48:01] sinelaw: uberjar, I happen to agree that exceptions are less prone to being neglected, but the point in this case is that even a bool result isn't avialable. you have zero information about errors
[22:48:09] seahawks7: smathy: why not behave like save though?
[22:48:22] Peaker: smathy: If there's an exception I forgot to handle - my program crashes, nicely reminding me to do it, no mystery. If I forget to handle errors explicitly - I get a mystery bug!
[22:48:31] seahawks7: smathy: i.e. .update & .update!
[22:48:42] tubbo: i mean...
[22:48:48] tubbo: if you forget to handle errors for your form
[22:49:05] tubbo: that's kinda like forgetting to test your code after committing it to master
[22:49:23] sinelaw: tubbo, validating isn't the same as handling errors
[22:49:23] Peaker: tubbo: and ideally I'd make that impossible by having a script do it for me
[22:49:29] smathy: seahawks7, because it's not an instance method. The instance method `update` *does* behave like the instance method `save`
[22:49:29] smathy: seahawks7, the class method `update` returns the object that you pointed at with the pkey so that you can get the full error messages and other things from your model.
[22:49:32] tubbo: true, sinelaw
[22:49:47] tubbo: regardless, if an actual error that must be handled happens, the db *will* throw an exception.
[22:49:50] Peaker: tubbo: good approach to software development is error prevention, not "just don't make errors, then"
[22:49:55] tubbo: if it's just a validation error, nbd
[22:49:56] smathy: seahawks7, otherwise every exception from Relation.update would just be followed by a Model.find(id) to get an instance so you could get the right error messages and so forth to populate your view.
[22:50:12] smathy: seahawks7, (or every false return)
[22:50:20] seahawks7: smathy: thanks
[22:50:46] sinelaw: i guess the docs aren't very explicit about all this
[22:50:47] Peaker: tubbo: but a validation error means I just lost data -- I called a method just to get some desired effect (update some db state), and it failed to achieve that effect, but my program merrily went on its merry way!
[22:50:50] tubbo: i think you're just misunderstanding the proper use of exceptions and validation errors in this case..
[22:51:12] tubbo: Peaker: that's your fault then
[22:51:14] tubbo: not rails or ruby's
[22:51:44] smathy: Peaker, I think it's just something you're not used to, it has honestly never taken me more than a second to dig in and work out why something wasn't being saved, especially with tests.
[22:52:07] Peaker: tubbo: well, you could say the same thing about passing a method the wrong number of arguments. when that happens, just avoid the method call, and add a "wrong_num_of_args" error to some list of errors somewhere that you can check
[22:52:09] tubbo: sorry if i sounded a little harsh but yeah, i think it's just you have to drink the cool-aid
[22:52:22] Peaker: tubbo: then it's your fault if you have wrong method calls
[22:52:24] smathy: seahawks7, FWIW, I agree that it'd be a nice symmetry to have Relation.update! that raises an exception, although I'd probably never actually use it.
[22:52:51] tubbo: Peaker: i guess the difference is like, "coding error" vs. "user error"
[22:52:53] Peaker: smathy, tubbo: Well, my coworkers spent a while scratching their heads about why some db data was randomly lost
[22:52:54] startab: Would anyone be able to help with appending a call to where() to the includes at the end of this query, its rather tricky because of the Geocoder gem's sensitivity to anything modifying its select clause http://pastie.org/9712968
[22:53:03] tubbo: Peaker: validations are really for user errors. exceptions are for coding errors.
[22:53:14] seahawks7: smathy: agreed, the use case is different as you pointed out though, thanks for outlining
[22:53:20] Peaker: tubbo: It's impossible to distinguish these reliably, really
[22:53:26] smathy: Peaker, that "wrong_num_of_args" adding errors to a list doesn't serve any purpose in a web app, the adding of errors to the model allows you to display those validation errors in the view. That's the whole driver behind that approach.
[22:53:31] Peaker: tubbo: if I have a coding error that passed "nil" instead of the user data into the ORM
[22:53:35] smathy: seahawks7, you're welcome.
[22:53:52] smathy: Peaker, maybe you need better coworkers :)
[22:53:56] Peaker: smathy: you could just take this list and put it as data inside the exception
[22:53:58] tubbo: Peaker: there actually is a way to distinguish those
[22:54:12] sinelaw: smathy, just for comparison's sake, in .NET's Entity Framework, a validation error causes an exception - this execption contains the actual validation information
[22:54:14] smathy: Peaker, which helps you how when your view is expecting a (for example) @person object?
[22:54:19] tubbo: all user params come over as strings :)
[22:55:01] Peaker: smathy: it makes the current information available just the same - the two approaches are power-equivalent, except one does not make it likely to accidentally lose information
[22:55:06] smathy: Peaker, basically, if it raised an exception, then every time your exception handler would have to have `@person = Person.find(id); @person.attach_errors(exception)` in it so it could give the right object back to the view with the errors attached to it.
[22:55:44] smathy: Peaker, no, the exception approach means that the developer would have to write the same cookie cutter code in every handler all over the place.
[22:56:01] smathy: Peaker, as it is, you get a @person back from the `Person.update` call and it already has the errors in it.
[22:56:14] smathy: Peaker, ready for what Rails was built for, making web apps.
[22:56:40] smathy: Peaker, Rails isn't written to make it impossible to write bad code, it's written to make it possible to write good code.
[22:56:47] webdestroya: ACTION sighs
[22:57:36] Peaker: smathy: Thanks for the explanation, I understand the logic behind it now -> I would name the method in a way that makes it clear it only attempts to do the desired change but does not actually do it in all cases
[22:58:30] smathy: Peaker, I won't disagree that it could be named better.
[22:58:52] smathy: Peaker, nor that it's confusing to have the class method and instance method of the same name act in very different ways.
[22:59:33] smathy: sinelaw, yes, doing that is definitely one way to go, Rails went a different way by always bundling errors up in the model that you return to the view.
[22:59:49] smathy: sinelaw, as I said, Rails isn't for everyone.
[22:59:59] tubbo: i like that approach personally
[23:00:25] tubbo: it allows for error-catching tools like exception_notifier and airbrake to exist
[23:00:41] tubbo: without having to always filter out certain exceptions you would never want to see
[23:00:45] startab: Anyone with strong ActiveRecord/SQL skills hanging around? Need help with a complicated query
[23:01:16] smathy: tubbo, I prefer my exceptions to be at a different stack level to where model validation errors are, and Ruby generally isn't a big exception user for business logic.
[23:01:30] uberjar: startab: just paste the query in a gist if someone can help they will
[23:01:32] smathy: tubbo, oh, you mean you like them bundled in the model.
[23:01:35] smathy: Yeah, me too.
[23:01:38] tubbo: smathy: =D
[23:01:47] seahawks7: so, im doing a talk in a couple of weeks. If you were at a rails meet up, and the talk was about simple load testing(using blitz.io), what would you guys think?
[23:01:55] startab: ubderja even better, a pastie http://pastie.org/9712968
[23:02:15] smathy: ...I think NOT using exceptions is something Ruby has done really well compared to some others, especially our coffee-flavored cousin.
[23:02:22] Peaker: I now see it as a programming model very fit for a view: You throw user input directly in, get webpages (or models that are intended to be directly rendered to web pages) out, that cover both success and error cases in the same way. But I would want to have a completely separate set of APIs (including ORM) that I can use in my backend that do not do that, but actually attempt to guarantee the effects happen
[23:02:58] smathy: seahawks7, sounds like a good topic.
[23:03:01] Peaker: Where the output isn't a webpage but intermediate data I use internally
[23:03:20] tubbo: Peaker: that doesn't seem too hard to build. a lightweight wrapper on top of active_record objects that encourage a consistent error handling strategy if you're in backend code all the time
[23:03:31] seahawks7: smathy: thanks, wasn't sure if the rails-agnostic portion of that would go over
[23:03:47] uberjar: seahawks7: I'm not in seattle, but I would rather learn how to do it without expensive third party platforms... jmeter, apachebench, etc
[23:03:51] tubbo: Peaker: there are also other ORMs like datamapper and sequel, which may do what you're asking. it's pretty easy to add other ORMs into rails, you don't *have* to use active_record.
[23:04:20] seahawks7: uberjar: yup, apachebench + blitz.io are my preferred toolsets
[23:04:25] Peaker: tubbo, smathy: OK, thanks! I understand it all better now
[23:04:27] seahawks7: never got into jmeter(probably to my detriment)
[23:04:30] smathy: Peaker, sure, and actually sometimes when you're writing backend jobs and so forth that errors API is cumbersome.
[23:04:45] smathy: Peaker, you're welcome.
[23:05:03] smathy: seahawks7, usually, anything that can make a Rails dev's life easier is welcomed.
[23:06:09] smathy: seahawks7, it'd definitely be good to show an `ab` example too, and the pros/cons of using a service like blitz
[23:06:18] smathy: That's a great value-add.
[23:07:30] uberjar: startab: sorry I can't help ya this time gotta run..
[23:07:39] startab: uberjar np
[23:28:59] blitz: lol highlights
[23:29:15] blitz: we've used blitz.io here too
[23:31:02] seahawks7: blitz: are you.... from blitz.io?
[23:31:16] blitz: nope, just a coincidence
[23:32:48] seahawks7: was hoping for some free credits
[23:44:15] weaksauce: startab what are you trying to do
[23:45:22] weaksauce: startab and what's currently happening
[23:45:37] startab: weaksauce Let me put together a pastie that'll explain everything
[23:49:32] startab: weaksauce Can I PM you?
[23:49:51] siaW: how do i write this test for zip code, test should check when zip code was given, but with incorrect format. currently i have this: https://eval.in/220154
[23:50:39] weaksauce: siaw do you have validations?
[23:50:47] siaW: weaksauce: yes
[23:51:08] weaksauce: can you just assert that address.valid? is true
[23:51:37] siaW: my validation for address https://eval.in/220155
[23:53:42] weaksauce: siaw put in good values for everything else and test for valid?
[23:54:06] siaW: i did but the test that even count it, doesn???t see it
[23:54:25] siaW: weaksauce: i have this def zip_code
[23:54:26] siaW: address = Address.new(street: "Limanowskiego", city: "Krakow" , zip_code: "89-345")
[23:54:27] siaW: address.valid?
[23:55:03] weaksauce: well every test method needs to start with test_ I think
[23:55:41] siaW: it passes
[23:56:10] siaW: but i want test to check when zip code was given, but with incorrect format.
[23:56:26] weaksauce: change the zip code to something that shouldn't pass
[23:56:44] weaksauce: address = Address.new(street: "Limanowskiego", city: "Krakow" , zip_code: "invalid")