« Back to channel list

#RubyOnRails - 19 October 2015

« Back 1 day Forward 1 day »
[00:01:34] Icey: has joined #RubyOnRails
[00:02:28] CanTonic: has joined #RubyOnRails
[00:06:06] oflannabhra: has joined #RubyOnRails
[00:06:14] kies^: has joined #RubyOnRails
[00:10:56] gambl0re: shouldn't current_user and current_user.id the same?
[00:11:00] gambl0re: be the same
[00:11:07] Aeyrix: Why would they be the same?
[00:11:29] Aeyrix: Should @animal and @animal.legs be the same?
[00:12:48] Radar: gambl0re: Why are you expecting that?
[00:13:19] ericjphillips: has joined #RubyOnRails
[00:13:27] aruntomar: has joined #RubyOnRails
[00:15:33] gambl0re: i thought current_user returns current user's id...nevermind
[00:15:58] stardiviner: has joined #RubyOnRails
[00:16:13] Radar: You have been misinformed.
[00:17:56] bonhoeffer: has joined #RubyOnRails
[00:18:09] bonhoeffer: Radar ??? thanks for the heads up on let
[00:22:24] moeabdol: has joined #RubyOnRails
[00:22:51] h7br1x: has joined #RubyOnRails
[00:23:25] bonhoeffer: has joined #RubyOnRails
[00:23:40] K_r3aPeR: has joined #RubyOnRails
[00:23:59] acti0nman: has joined #RubyOnRails
[00:24:31] VeryBewitching: gambl0re: current_user returns a User object.
[00:24:38] ahmgeek: has joined #RubyOnRails
[00:24:41] VeryBewitching: gambl0re: current_user.id is the ID of that object.
[00:24:51] ahmgeek: can anyone explain this to me please: redirect_to proc { edit_post_url(@post) }
[00:25:15] ahmgeek: why it's different from: redirect_to edit_post_url(@post)
[00:26:28] thejamespinto: has joined #RubyOnRails
[00:27:41] simkessy: Anyone have a good recommendation or strategy for api security with access tokens?
[00:27:56] FailBit: ahmgeek: there's no reason to use the proc syntax
[00:28:14] K_r3aPeR: has joined #RubyOnRails
[00:28:14] rhizome: who is saying to use proc there
[00:28:35] FailBit: simkessy: I'm feeling deja vu
[00:28:51] chopin: has joined #RubyOnRails
[00:29:23] simkessy: FailBit: how come?
[00:29:46] FailBit: greenride can explain
[00:29:49] FailBit: it's bedtime for me though
[00:30:07] montagesoftware: has joined #RubyOnRails
[00:30:57] rubyonrails080: has joined #RubyOnRails
[00:32:14] simkessy: alright goodnight :/
[00:32:23] jgpawletko: has joined #RubyOnRails
[00:32:56] one_zero: has joined #RubyOnRails
[00:35:20] ahmgeek: FailBit: I saw it here: http://api.rubyonrails.org/classes/ActionController/Redirecting.html
[00:35:24] ahmgeek: that's why I asked
[00:36:23] rhizome: yeah i'm not sure why that's in there.
[00:37:37] ahmgeek: I always searched for any reasons or examples to write Proc or Lambdas in rails, I really didn't find any use cases for it so far, despite using it in rails itself, as I still new to rails
[00:38:44] greenride: simkessy: I was bugging people here about api security and csrf tokens a little while ago. That said, Code School has a tutorial on Rails apis. The last part number 6, has a tutorial on authentication that is pretty good. I also recommend this book http://apionrails.icalialabs.com/book
[00:40:05] simkessy: greenride: awesome thanks very much for the link and info
[00:40:36] greenride: simkessy: yw
[00:40:52] simkessy: greenride: is the codeschool chapter free?
[00:41:00] greenride: The book is
[00:41:36] simkessy: kk ill look at that then
[00:42:30] yfeldblum: has joined #RubyOnRails
[00:43:48] K3VA: has joined #RubyOnRails
[00:43:59] IFrank00: has joined #RubyOnRails
[00:47:11] towski_: has joined #RubyOnRails
[00:47:16] K3VA: Anyone have any material covering price comparison website design?
[00:49:27] rubyonrails778: has joined #RubyOnRails
[00:52:45] beauby: has joined #RubyOnRails
[00:52:49] rdavila: has joined #RubyOnRails
[00:53:43] framling: has joined #RubyOnRails
[00:54:49] spellbook: has joined #RubyOnRails
[00:58:20] kayloos: has joined #RubyOnRails
[00:58:48] dopie: has joined #RubyOnRails
[00:59:43] capin: K3VA: that's a pretty broad question :l
[01:00:27] MEATCHICKEN: I have a model that needs to have a "flag" determined for it but it requires multiple calculations reaching into deep relationships
[01:00:36] MEATCHICKEN: What is the best way to approach this?
[01:00:38] K3VA: eek! yeah.. it is. To narrow it down a bit. I'm envisioning a site like PcPartPicker, but for another industry
[01:01:03] MEATCHICKEN: The way I see it - I can have cascading countercaches or something but testing that will be a bitch
[01:01:37] artto: has joined #RubyOnRails
[01:01:56] K3VA: I'm having massive problems with trying to figure out how to structure the database since I'll have multiple product types with distincet attributes.
[01:02:26] rdavila: has joined #RubyOnRails
[01:04:11] lessless: has joined #RubyOnRails
[01:04:55] MEATCHICKEN: K3VA, read a book about database design
[01:05:01] MEATCHICKEN: how to structure your tables
[01:05:14] nya: has joined #RubyOnRails
[01:06:21] thejamespinto: hey guys, is anybody using Rubber? I can't get it to work :( please
[01:06:30] arathald: alright time to ruby and cook
[01:06:48] Aeyrix: ruby & chill
[01:07:02] arathald: you gotta buy me dinner first
[01:07:06] arathald: or cook me dinner
[01:09:46] arathald: I've spent several hours on this, and I'm up to page 18 of the book
[01:12:44] kjb513: has joined #RubyOnRails
[01:14:01] tenzan: has joined #RubyOnRails
[01:14:14] workmad3: has joined #RubyOnRails
[01:15:08] arathald: (I spent a while reading through the form_for source to understand when and why passing url: is necessary)
[01:16:30] diego1: has joined #RubyOnRails
[01:17:45] capin: yeah i'm still looking for answer to my refile question :l http://stackoverflow.com/questions/33190587/
[01:17:59] diego1: has joined #RubyOnRails
[01:19:15] bonhoeffer: has joined #RubyOnRails
[01:20:59] shmilan: has joined #RubyOnRails
[01:22:44] stannard: has joined #RubyOnRails
[01:28:33] targaf: has joined #RubyOnRails
[01:30:44] arathald: capin: not sure. all I can suggest is to read the refile code and see :P
[01:31:39] darrencauthon: has joined #RubyOnRails
[01:32:44] capin: arathald: thanks, i was thinking it had something to do with strong params, FWIW
[01:33:24] arathald: I'm wondering why you're not seeing csv_filename - figuring that out might give you your answer
[01:33:58] arathald: as a disclaimer, I'm extremely new to rails, so I may have no clue what I'm talking about :)
[01:34:22] willharrison: has joined #RubyOnRails
[01:34:27] han-`: has joined #RubyOnRails
[01:34:56] oflannabhra: has joined #RubyOnRails
[01:35:08] capin: "not seeing csv_filename" what do you mean by that?
[01:37:22] arathald: in the second answer, he suggests adding manual validation - your response was that the code doesn't work because it can't find csv_filename
[01:37:57] arathald: but apparently, that's a helper refile is supposed to add for you
[01:39:11] arathald: I don't know if that makes sense or if I'm completely misunderstanding
[01:40:01] capin: no that makes sense, but it isn't working for whatever reason
[01:40:40] arathald: yep. I'd look into why it isn't working - why that helper isn't being created or why you can't access it
[01:40:58] arathald: is this a security thing, by the way?
[01:42:22] bonhoeffer: has joined #RubyOnRails
[01:43:21] arathald: or just a more general validating that the file that's being uploaded is in the right format (without worrying about someone intentionally setting the wrong extension or content type)
[01:45:27] capin: well i don't want to put that code in the wild just yet because anyone could upload any type of file knowing the API address, so yeah it's more of a security thing
[01:45:28] acovrig: has joined #RubyOnRails
[01:45:54] capin: i want to be able to set a limit on the file size that is being uploaded too FWIW
[01:45:58] arathald: then file extension is probably not sufficient. and content_type can be set to anything by the end user
[01:47:01] arathald: my inclination would be to validate that the file is what the user claims it to be
[01:47:06] bonhoeffer: has joined #RubyOnRails
[01:47:16] arathald: i.e. a deeper validation
[01:47:53] renews: has joined #RubyOnRails
[01:48:02] woods: has joined #RubyOnRails
[01:48:05] arathald: I don't quite know the best way of going about that, but not doing so strikes me as a potential security risk. It's possible refile already offers a way of taking care of that
[01:49:21] platzhirsch: has joined #RubyOnRails
[01:49:53] platzhirsch: Finally, a countdown http://rails5countdown.com/
[01:50:06] capin: hehe ...nice :D
[01:50:09] tvon: has joined #RubyOnRails
[01:50:41] arathald: (I'm new to RoR, but I'm paid well to think about website security ;) )
[01:50:56] oflannabhra: has joined #RubyOnRails
[01:51:26] capin: hehe good to know
[01:51:42] xcm: has joined #RubyOnRails
[01:52:32] arathald: ok, off to the store. need lime, and I want to see if I can find kaffir lime leaves
[01:52:51] arathald: I accidentally made tom yum minus those two ingredients, so I'm going to see if I can find them :)
[01:54:39] ischwartz: has joined #RubyOnRails
[01:57:16] GriffinHeart: has joined #RubyOnRails
[01:57:57] nya: has joined #RubyOnRails
[01:58:06] yardenbar: has joined #RubyOnRails
[01:59:31] htmldrum: has joined #RubyOnRails
[02:00:38] platzhirsch: has left #RubyOnRails: ()
[02:01:14] A124: has joined #RubyOnRails
[02:02:24] arthurthefourth: has joined #RubyOnRails
[02:02:26] artto: has joined #RubyOnRails
[02:02:34] chopin: has joined #RubyOnRails
[02:05:19] roxtrongo: has joined #RubyOnRails
[02:07:34] GriffinHeart: has joined #RubyOnRails
[02:08:11] moeabdol: has joined #RubyOnRails
[02:12:27] lessless: has joined #RubyOnRails
[02:15:22] rdavila: has joined #RubyOnRails
[02:18:02] pydave6367: has joined #RubyOnRails
[02:23:30] Radar: wb back arathald
[02:27:35] htmldrum: has joined #RubyOnRails
[02:27:41] annlewis: has joined #RubyOnRails
[02:29:05] GriffinHeart: has joined #RubyOnRails
[02:31:21] arathald: also, I'm back from the store. no kaffir lime leaves :(
[02:31:50] Radar: asian groceries usually sell them
[02:31:56] Radar: at least, in my experience
[02:32:12] SteenJobs: has joined #RubyOnRails
[02:32:15] ahmgeek: has joined #RubyOnRails
[02:32:23] arathald: apparently, there's a lot more restriction on importing them than there used to be
[02:32:25] ahmgeek: anyone have a solution for this guys ? https://github.com/manshar/manshar/pull/202
[02:32:46] arathald: Radar: the nearest asian grocery is a 20ish minute drive away and I'm too tired to bother :P
[02:33:28] ahmgeek: Radar: MAD HUGS if you're around.
[02:34:36] Radar: ahmgeek: I don't use dagonfly so I don't have any ideas.
[02:34:58] ahmgeek: what you usually use ?
[02:35:02] aruntomar: has joined #RubyOnRails
[02:35:23] arathald: I'm just zesting 2 of the limes I got into the soup. maybe not *exactly* right, but tasty enough
[02:35:36] arathald: kk, back to the book while my soup simmers
[02:37:07] Radar: ahmgeek: paperclp
[02:37:19] Radar: arathald: are you reading R4IA at the moment?
[02:37:28] arathald: very slowly :)
[02:37:31] Radar: cool :) I'll leave you to it.
[02:37:39] pwnd_nfsw: I finally got to the API chapter heh
[02:37:51] arathald: up to page 20
[02:38:01] roxtrongo: has joined #RubyOnRails
[02:38:02] Radar: pwnd_nfsw: TIL people read past chapter 6 :)
[02:38:06] ahmgeek: gonna buy it soon :blush"
[02:38:12] arathald: Radar: I've been reading through the ruby source for anything I don't understand
[02:38:33] arathald: *rails source, though I guess ruby source is also accurate :)
[02:38:49] pwnd_nfsw: Radar, is that really a thing?
[02:39:12] arathald: soent a while on form_for yesterday
[02:39:14] pwnd_nfsw: I mean, a bit of it gets repetitive, but there's a few tips scattered about
[02:39:33] nertzy: has joined #RubyOnRails
[02:39:55] h7br1x: has joined #RubyOnRails
[02:40:16] pwnd_nfsw: I should stop reading the book and actually attempt to apply what I've.. _read_. I apparently don't retain information very well unless I actually practice something
[02:40:29] Radar: pwnd_nfsw: I've heard that a lot of people don't read past the first couple of chapters of most programming books.
[02:40:43] Radar: pwnd_nfsw: there's a whole body of research about knowledge being retained when it's practiced ;)
[02:40:48] pwnd_nfsw: If I can't get into it, then I don't.
[02:41:00] Radar: http://thetalentcode.com/ book talks about it quite a lot
[02:41:11] sevenseacat: if you read past the first few chapters? <_<
[02:41:17] baweaver: has joined #RubyOnRails
[02:41:19] arathald: honestly, that's very often true if the first couple of chapters are enough to jump start me
[02:43:23] arathald: we'll see what happens here ;)
[02:44:02] pwnd_nfsw: Been trying to do exercises that help improve my ability to store short term memory
[02:44:03] sevenseacat: the list of programming books I want to read grows faster than I can read them
[02:46:31] sevenseacat: and then I just deviate from the list entirely like when Programming Phoenix came out
[02:48:08] sevenseacat: (which is a good book btw)
[02:48:08] arathald: Radar: extremely true. I'm a musician, and what most people don't realize is that talent is only a tiny, tiny part of the equation. someone who can do insane things on a guitar probably practiced doing insane things on a guitar more than most people realize
[02:48:45] nurey: has joined #RubyOnRails
[02:49:09] pwnd_nfsw: but does it scale?
[02:49:20] arathald: people don't like hearing that things take effort. they're trying to find the skill they're magically amazing at without working at it :)
[02:49:48] pwnd_nfsw: of course, who actually wants to put in effort?
[02:49:59] pwnd_nfsw: it's those that see what the effort can provide in the long run that succeed
[02:51:04] arathald: by the way, Radar, despite only being 20 pages in, adding in the step of reading the source for anything I don't understand or that confuses me has made me immensely more comfortable with learning this stuff
[02:51:44] stardiviner: has joined #RubyOnRails
[02:52:08] Radar: pwnd_nfsw: People ask me "how can I build a website?" and I _really_ want to answer with "practice for x years" but that advice isn't practical, so I don't :P
[02:52:10] Radar: But it's the truth!
[02:52:15] juanca_: has joined #RubyOnRails
[02:52:24] hephaestus_rg: has joined #RubyOnRails
[02:52:28] pwnd_nfsw: Or you can suggest PHP
[02:55:30] chouhoulis: has joined #RubyOnRails
[02:57:44] Karloku: has joined #RubyOnRails
[02:59:13] willharrison: has joined #RubyOnRails
[03:00:41] GriffinHeart: has joined #RubyOnRails
[03:00:52] quazimodo: has joined #RubyOnRails
[03:01:45] nya: has joined #RubyOnRails
[03:01:50] arathald: okay, question that I don't think reading the code will help answer: why does the default destroy method created for a scaffold redirect to _url instead of _path?
[03:02:21] workmad3: has joined #RubyOnRails
[03:03:00] Radar: Good question.
[03:03:09] artto: has joined #RubyOnRails
[03:03:46] arathald: you said it was the case, but never explained why :)
[03:06:13] Radar: I can't find the code that generates that whole destroy action./
[03:06:31] Radar: https://github.com/rails/rails/blob/v4.2.4/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb#L47-L51
[03:06:33] nurey: has joined #RubyOnRails
[03:06:33] Radar: I get to here, but it's wrong.
[03:08:10] Radar: hah this is great :) I can't find it
[03:08:57] moeabdol: has joined #RubyOnRails
[03:09:12] pwnd_nfsw: "In the controller, though, *_url is needed for redirect_to because the
[03:09:12] pwnd_nfsw: HTTP specification mandates that the Location: header in 3xx redirects
[03:09:12] pwnd_nfsw: is a complete URL."
[03:09:17] pwnd_nfsw: https://www.ruby-forum.com/topic/101346#221052
[03:09:29] Radar: But it'll work for _path too./
[03:09:30] braincrash: has joined #RubyOnRails
[03:10:21] Radar: Yeah, I don't know on this one where it's coming from.
[03:10:32] quazimodo: has joined #RubyOnRails
[03:10:34] Radar: There's nothing in the Rails source that I have on my machine which matches the output I see when I run "rails g scaffold post"
[03:10:38] diego1: has joined #RubyOnRails
[03:11:15] diego1: has joined #RubyOnRails
[03:11:32] juanca_: has joined #RubyOnRails
[03:12:20] pwnd_nfsw: Could it be possible that redirect_to does some magic when it doesn't have full url?
[03:13:29] pwnd_nfsw: I think it does
[03:13:43] pwnd_nfsw: https://github.com/rails/rails/blob/2090615d39c071c9eb25e715275eb79f3f9b6266/actionpack/lib/action_controller/metal/redirecting.rb#L69
[03:13:48] rakm: has joined #RubyOnRails
[03:14:28] davidmst: has joined #RubyOnRails
[03:14:28] pwnd_nfsw: Way past my bed time, nn
[03:16:52] arathald: so... it's basically to match the HTTP spec, even though it'll work with _path?
[03:19:12] moeabdol: has joined #RubyOnRails
[03:19:18] arup_r: has joined #RubyOnRails
[03:21:48] davidmst: has left #RubyOnRails: ()
[03:24:13] hd1: has joined #RubyOnRails
[03:24:43] davidsj: has joined #RubyOnRails
[03:25:24] davidsj: Hey everyone, I was just wondering if anyone could point me in the right direction regarding building models that can be extended with a secondary extension table... eg. `users` table is extended by `users_extend` table
[03:28:28] annlewis: has joined #RubyOnRails
[03:32:09] pydave6367: has joined #RubyOnRails
[03:37:14] nogic: has joined #RubyOnRails
[03:37:46] elventai1s: has joined #RubyOnRails
[03:38:13] arthurthefourth: has joined #RubyOnRails
[03:38:42] elventai1s: has left #RubyOnRails: ()
[03:39:15] elventails: has joined #RubyOnRails
[03:39:30] elventails: greets - I'm trying to do a route match e.g. match '/xyz/(:id)' => redirect('http://somewhere.com/') <-- how can I pass the :id to the redirect?
[03:41:43] GriffinHeart: has joined #RubyOnRails
[03:42:05] arathald: you should be able to fetch the id in the controller with params[:id] and then use that to build the redirect
[03:42:44] elventails: arathald: I see what you mean - so I couldn't technically pass the :id to the redirect in the routes file only
[03:43:29] moeabdol: has joined #RubyOnRails
[03:45:52] hd1: has left #RubyOnRails: ()
[03:46:03] arathald: if there's a way, I'd not be the one to know about it, but I don't think so
[03:46:33] arathald: it's easy enough just to create a new controller to handle the redirect. someone can correct me if there's a way to do it directly from the route
[03:46:37] pawnbox: has joined #RubyOnRails
[03:46:49] elventails: arathald: that's fine - thanks a lot
[03:46:57] arathald: but in general, a route tells the application what code to run to handle a specific request, rather than just mapping one url to another
[03:47:01] arathald: if that makes sense
[03:47:29] elventails: arathald: yep - totally; might simply handle this routing at the webserver layer instead/before it hits the app
[03:47:41] elventails: seems like a better spot in this specific case
[03:47:45] arathald: (by the way, just tried this, it works like a charm)
[03:48:06] arathald: elventails: I don't know the convention in RoR, but I know it's not uncommon to have a specific application set up just to handle redirects
[03:48:28] arathald: sorry, not application, controller
[03:48:39] arathald: I'm thinking in the language of a different framework I'm more familiar with :)
[03:49:19] arathald: so you'd have a redirect controller with redirect#xyz to handle the xyz redirect, for example. and all redirects would go through it
[03:49:41] arathald: if there's a more idiomatic way to do so in rails, someone feel free to correct me here
[03:49:45] elventails: yep - I know what you mean
[03:49:54] aruntomar: has joined #RubyOnRails
[03:53:26] arathald: in fact, I'm leaving that controller in the RoR site I'm working on now. That'll come in useful, I imagine
[03:53:58] arathald: brb. have to run to the store... again :|
[03:54:07] arathald: we're out of reasonably-sized storage containers
[03:54:18] arathald: and low on fridge space
[03:56:18] chouhoulis: has joined #RubyOnRails
[03:57:26] GriffinHeart: has joined #RubyOnRails
[03:58:12] ArTiSTiX: has joined #RubyOnRails
[04:00:24] jacksparrow007: has joined #RubyOnRails
[04:03:10] nya: has joined #RubyOnRails
[04:03:55] artto: has joined #RubyOnRails
[04:05:28] stannard: has joined #RubyOnRails
[04:06:29] bnannas: has joined #RubyOnRails
[04:10:29] arup_r: davidsj: You meant, one model to work with 2 different table
[04:11:25] rickmasta: has joined #RubyOnRails
[04:12:18] kp666: has joined #RubyOnRails
[04:12:54] aruntomar: has joined #RubyOnRails
[04:13:53] bnannas: i've just inherited my first rails project (am total noob). it only renders json via jbuilder, but when i try to render a simple html.erb file, it always complains "MissingTemplateFIle ... with {:locale=>[:en], :formats=>[:json]]"
[04:14:13] moeabdol: has joined #RubyOnRails
[04:14:15] bnannas: am i likely doing something stupid? or is there a config option that makes rails expect to render json?
[04:16:38] pawnbox: has joined #RubyOnRails
[04:17:05] davidsj: @arup_r, I mean one model that is the sum of two tables
[04:18:08] juanca_: has joined #RubyOnRails
[04:18:53] davidsj: So say my `users` table has `id`, `first_name`, `last_name`, then my `users_extend` table has `extra_field_1`, `extra_field_2`, etc.
[04:18:54] roxtrongo: has joined #RubyOnRails
[04:19:10] davidsj: As determined by the needs of whoever may be extending upon the application
[04:19:32] acti0nman: has joined #RubyOnRails
[04:19:48] arup_r: hum .. You want composition then
[04:19:51] davidsj: I know there are other ways to accomplish this, but I'm working with an existing data structure that unfortunately can't budge
[04:20:01] tsujp: has joined #RubyOnRails
[04:20:15] moeabdol: has joined #RubyOnRails
[04:21:41] arup_r: davidsj: Your question lead me to new thing. Look at this http://apidock.com/rails/ActiveRecord/Aggregations/ClassMethods/composed_of
[04:21:46] gambl0re: has joined #RubyOnRails
[04:21:50] arup_r: I never knew it exist
[04:22:22] arup_r: http://stackoverflow.com/questions/18638874/activerecord-composition
[04:23:07] framling: has joined #RubyOnRails
[04:23:36] nyaa: has joined #RubyOnRails
[04:23:36] davidsj: Thanks for the links, @arup_r, I'll have a look into them
[04:24:05] davidsj: At a glance, the second looks like maybe it's the inverse of my problem though, where they want two models for one table rather than two tables to compose one model
[04:24:05] arup_r: davidsj: sure .. happy to help you
[04:24:36] davidsj: Very much appreciated though, knowing the right terminology definitely helps with finding the right answers
[04:24:57] arup_r: davidsj: I think you need to have a 2 classes for 2 tables. and then using composed_of you can connect one table with the other
[04:25:00] sevenseacat: TIL about composed_of
[04:25:10] arup_r: TIL means ?
[04:25:15] davidsj: "today I learned"
[04:25:30] arup_r: I never reached there
[04:25:50] arup_r: davidsj: That composed_of is the one will solve your problem
[04:26:08] gambl0re: has joined #RubyOnRails
[04:26:19] braincrash: has joined #RubyOnRails
[04:27:39] davidsj: Thanks again!
[04:29:14] annlewis: has joined #RubyOnRails
[04:33:16] madebymarkca: has joined #RubyOnRails
[04:33:27] IrishGringo: has joined #RubyOnRails
[04:38:18] bmalum: has joined #RubyOnRails
[04:44:31] Coldblackice: has joined #RubyOnRails
[04:46:15] tsujp: has joined #RubyOnRails
[04:46:47] stardiviner: has joined #RubyOnRails
[04:48:59] gambl0re: has joined #RubyOnRails
[04:50:28] workmad3: has joined #RubyOnRails
[04:51:49] bmalum: has joined #RubyOnRails
[04:54:45] mloy: has joined #RubyOnRails
[04:54:52] tsujp: has joined #RubyOnRails
[04:56:02] tsujp: has joined #RubyOnRails
[04:56:42] roxtrongo: has joined #RubyOnRails
[04:57:01] chouhoulis: has joined #RubyOnRails
[04:57:21] troysk: has joined #RubyOnRails
[04:57:38] andersoldahl: has joined #RubyOnRails
[04:58:04] GriffinHeart: has joined #RubyOnRails
[05:01:43] gambl0re: has joined #RubyOnRails
[05:02:27] pawnbox: has joined #RubyOnRails
[05:03:36] tsujp: has joined #RubyOnRails
[05:04:40] artto: has joined #RubyOnRails
[05:07:55] Babelfish: has joined #RubyOnRails
[05:09:36] pawnbox: has joined #RubyOnRails
[05:10:32] linocisco: has joined #RubyOnRails
[05:11:19] Radar: hi again linocisco
[05:11:25] mloy: has joined #RubyOnRails
[05:11:39] arathald: on to chapter 2!
[05:11:49] arathald: after I clean the kitchen
[05:11:55] linocisco: any popular sites built on rubyonrails rather than gocamp,groupon, shopify which I am not familiar?
[05:11:55] sevenseacat: chapter 2 is testing. much fun.
[05:12:02] sevenseacat: linocisco: github?
[05:12:04] Radar: linocisco: bikeexchange.com.au
[05:12:05] linocisco: Radar, good morning
[05:12:06] arathald: i hate testing :|
[05:12:14] Radar: arathald: You'll learn to love it.
[05:12:24] Ropeney: has joined #RubyOnRails
[05:12:52] sevenseacat: there are so many awesome tools out there to make testing really expressive and intuitive, once you wrap your head around them
[05:13:04] sevenseacat: though now that I read that back it sounds like a bit of a contradiction.
[05:13:10] linocisco: Radar, I am sorry never heard in my asia region. ok thanks anyway bro
[05:13:24] Radar: linocisco: heh that's ok :) It's the site that I work on every dayu.
[05:13:55] arathald: most of my formal experience with automated testing is junit. the most complicated bit always being figuring out how the hell to mock things the right way
[05:14:07] sevenseacat: xUnit libraries drive me nuts
[05:14:25] sevenseacat: junit, phpunit, testunit, exunit, you name it
[05:14:52] leslie1: has joined #RubyOnRails
[05:15:14] arathald: on the plus side, I now know how to bend a java enum to my will
[05:15:20] arathald: in a test environment
[05:15:26] linocisco: Radar, good to know. In terms of design, most websites built on Rubyon Rails are top to bottom approach. Is that default standard? any site with menu in left column and content on the right?
[05:15:42] Radar: linocisco: heh, that doesn't need to be the way they're designed.
[05:15:55] Radar: Rails is more about the backend imo
[05:16:15] linocisco: Radar, ok. thanks
[05:16:36] sevenseacat: rails doesn't give two hoots about where you put your nav bar
[05:16:57] arathald: anyway, I *do* need to clean the kitchen. creating this much delicousness can be a messy job
[05:18:30] linocisco: Radar, the first rails book I found with one day rails class was https://www.railstutorial.org/book using online editor and vagrant which I dont like to configure
[05:18:58] baweaver: has joined #RubyOnRails
[05:19:13] Radar: Does it really now encourage using an online editor and vagrant? ew
[05:19:40] Radar: Great if you've got a persistent internet connection.
[05:19:42] Radar: Terrible otherwise.
[05:19:55] Radar: (I do my best development without an internet connection)
[05:20:06] sevenseacat: yes, it uses cloud9 now from memory
[05:20:11] Radar: ew ew ew ew ew
[05:20:16] Radar: Indeed it does
[05:20:26] Radar: I disagree with this decision quite... emotionally.
[05:20:32] Radar: ACTION has a meme for this
[05:20:41] linocisco: Radar, no I dont have good and cheap constant internet.
[05:20:42] toy: has joined #RubyOnRails
[05:20:47] moeabdol: has joined #RubyOnRails
[05:20:54] linocisco: Radar, second one is Ruby on Rails Power!: The Comprehensive Guide by Aneesha Bakharia
[05:20:59] Radar: It's quite first-world of him to do that.
[05:21:06] Radar: said meme http://imgur.com/Z2ovsJC
[05:21:45] linocisco: Radar, that is again using windows based configuration but I am using ubuntu .Hence that is not ok
[05:22:03] Radar: linocisco: Rails 4 in Action will tell you how to setup Rails for both Windows and Ubuntu.
[05:22:12] sevenseacat: in Rails 4 in Action we discuss installation and setup for Windows, OSX and Linux (Fedora/Ubuntu)
[05:22:12] diegoviola: when opening an issue on github, should I include 200 lines of code in the thread or it's better to link to a gist issue?
[05:22:23] Radar: diegoviola: link to a Gist.
[05:22:25] rickmasta: has joined #RubyOnRails
[05:22:26] dhjondoh: has joined #RubyOnRails
[05:22:26] linocisco: Radar, i am glad to see your book finally
[05:22:28] nemo_: has joined #RubyOnRails
[05:22:31] diegoviola: Radar: ok ty
[05:22:46] toy: welcome nemo \m/
[05:22:52] sevenseacat: diegoviola: I hope you can distill that 200 lines down to a minimal example that is significantly shorter.
[05:23:10] diegoviola: sevenseacat: it's not really code, it's a config issue I'm having with my window manager
[05:23:52] diegoviola: sorry, this isn't a ruby/rails issue at all
[05:23:59] dopie: I am trying to upload multiple files at once with carrier wave and I am getting this error Why am I getting a can't cast Array to https://gist.github.com/staycreativedesign/4758425023e9db7d71ff
[05:24:10] sevenseacat: colour me not surprised.
[05:24:18] Radar: ACTION raises eyebrows
[05:24:26] Radar: Can't cast array to... what?
[05:24:36] Radar: https://gist.github.com/staycreativedesign/4758425023e9db7d71ff#file-_form-html-erb-L20
[05:24:39] Radar: What's with the name parameter here?
[05:24:52] diegoviola: sevenseacat: I asked on #github first, but nobody responded there
[05:25:08] dopie: Radar, I don't use that for multiple file uploads?
[05:25:18] Radar: dopie: Why do you think you need that name parameter?
[05:25:21] Radar: dopie: [citation needed]
[05:25:48] IFrank00: has joined #RubyOnRails
[05:26:34] linocisco: Radar, For bikeexchange, another country it should include is Denmark. They love to ride
[05:27:31] Radar: linocisco: we are working on it :)
[05:28:44] linocisco: Radar, cool
[05:29:08] dopie: Radar, ok...
[05:29:20] dopie: I was looking at rails casts
[05:29:26] Radar: dopie: [citation needed]
[05:30:08] annlewis: has joined #RubyOnRails
[05:31:19] beauby: has joined #RubyOnRails
[05:31:29] lxsameer: has joined #RubyOnRails
[05:31:44] towski_: has joined #RubyOnRails
[05:31:47] dopie: http://stackoverflow.com/questions/28442584/rails-carrierwave-multiple-images-with-mount-uploaders
[05:31:58] Radar: I'm quite loving having tests written already so that I can write more tests to assert that my code is going to behave properly once it's written.
[05:32:17] dopie: but it didn't work... so I'm not sure where to go from here
[05:32:24] seank_: has joined #RubyOnRails
[05:32:28] Radar: Try removing the name option.
[05:33:15] trautwein: has joined #RubyOnRails
[05:36:52] dopie: ok I removed the name option and edit the shoot_params to require :photos instead of {photos: []}
[05:37:08] dopie: and that gave me an error on the log
[05:38:43] dopie: Unpermitted parameter: photos
[05:38:49] djbkd: has joined #RubyOnRails
[05:39:07] sevenseacat: this sounds like 'lets try random things and see if they work'
[05:39:25] Radar: dopie: Show us the code again.
[05:39:41] dopie: sevenseacat, well I am trying to understand it
[05:39:57] djbkd: has joined #RubyOnRails
[05:40:12] dopie: https://gist.github.com/staycreativedesign/4758425023e9db7d71ff
[05:40:42] Radar: https://gist.github.com/staycreativedesign/4758425023e9db7d71ff#file-shoots_controller-rb-L72 seems weird
[05:40:54] sevenseacat: I don't believe you can do multiple: true on a file field like that.
[05:40:57] Radar: params.require(:shoot).permit(:image, :name, photos: [])
[05:41:00] Radar: sevenseacat: it's in the docs
[05:41:14] Radar: ACTION awaits the TIL
[05:41:21] sevenseacat: ACTION is looking
[05:41:34] Radar: dopie: !g TIL
[05:41:45] sevenseacat: well you appear to be correct, it is in the docs
[05:42:36] sevenseacat: https://gist.github.com/staycreativedesign/4758425023e9db7d71ff#file-shoot-rb-L2 this is a little wrong though
[05:42:48] sevenseacat: you should likely have a Photo model or something, with an attached uploader
[05:43:35] rvanlieshout: has joined #RubyOnRails
[05:43:38] sevenseacat: though actually
[05:43:45] sevenseacat: what does the schema for your shoots table look like?
[05:43:52] tenzan: has joined #RubyOnRails
[05:44:32] lessless: has joined #RubyOnRails
[05:44:38] tagrudev: has joined #RubyOnRails
[05:44:47] sevenseacat: and what dbms are you using
[05:45:11] dopie: https://gist.github.com/staycreativedesign/7922a4f9a968f54e31d3
[05:45:21] dopie: this is a straight scaffold ...
[05:45:32] bmalum: has joined #RubyOnRails
[05:45:35] dopie: i didn't really customize anything I just wanted to learn carrier wave multi file upload
[05:45:37] sevenseacat: https://gist.github.com/staycreativedesign/7922a4f9a968f54e31d3#file-schema-rb-L16-L17 well this looks like a big problem
[05:45:49] sevenseacat: and AR isnt a dbms
[05:45:59] dopie: its a ORM
[05:46:04] sevenseacat: and we don't know what you scaffolded so we don't know what you're working with
[05:47:04] sevenseacat: I'm guessing the column you're using for photos isnt an array/json/whatever
[05:47:09] sevenseacat: so you can't store the data in it
[05:47:17] Radar: steps to reproduce in a new app would be great
[05:47:24] Radar: I'm finding this really hard to debug by proxy
[05:47:29] MartinElvar: has joined #RubyOnRails
[05:47:44] jas02: has joined #RubyOnRails
[05:48:08] dopie: add_column :shoots, :photos, :json
[05:49:12] dopie: Can I put it in a repo/
[05:49:25] moeabdol: has joined #RubyOnRails
[05:50:26] dici: has joined #RubyOnRails
[05:50:46] arathald: yay! kitchen clean!
[05:51:47] Radar: dopie: try it
[05:51:47] arathald: ACTION resumes slowly reading r4ia
[05:52:20] dopie: https://github.com/staycreativedesign/jquery-file-upload-test
[05:53:10] moeabdol: has joined #RubyOnRails
[05:53:15] Radar: Thanks dopie
[05:53:21] sevenseacat: does sqlite support json columns?
[05:53:31] sevenseacat: there we go. problem solved.
[05:53:50] sevenseacat: hence I asked what dbms you were using :P
[05:54:02] chrissonar: has joined #RubyOnRails
[05:54:02] dopie: sevenseacat, Radar thank you!
[05:54:10] Radar: I agree with sevenseacat about there being a Photo model
[05:54:31] sevenseacat: Radar: dopie's code is c&ped from the carrierwave docs though, so i guess thats the newfangled way of doing it :)
[05:57:48] chouhoulis: has joined #RubyOnRails
[05:58:36] yogeshrt: has joined #RubyOnRails
[06:01:09] kies^: has joined #RubyOnRails
[06:01:49] arup_r: I am giving mail method to: option an array of emails. It triggers a email when a asset is created. It is sending a single email it is in devlopment env. But I got feedback that in production a user is getting same email twice. Any idea what could be wrong? https://gist.github.com/aruprakshit/9853d324b4e9b93f1d8d
[06:01:56] arup_r: Or how can I debug this?
[06:02:47] rvanlieshout: arup_r: have you verified it's actually been sent twice?
[06:03:37] sevenseacat: that log doesnt show a duplicatge email being sent.
[06:03:52] arup_r: I am looking in dev env with mailcatcher as an smtp client. I am not seeing any issue. But I got 2 tickets on the the same issue from prod
[06:04:01] arup_r: log is from dev machine
[06:04:05] rvanlieshout: arup_r: no proof = didn't happen
[06:04:36] U7se6: has joined #RubyOnRails
[06:05:02] arup_r: Yes, it did happen. No idea although. I don't have access to production yet, I will ask.But just asking, if any settings are there which is different from dev to prod
[06:05:18] rvanlieshout: how do you know it happened?
[06:05:22] rvanlieshout: just because somebody told you so?
[06:05:40] arup_r: They raised a ticket and attached 2 same emails to the ticket to show me as a proof
[06:05:59] sevenseacat: ten bucks says theyre not the same email
[06:06:33] arup_r: anyway, I will ask production access, for me it is ok.
[06:06:44] arup_r: at least in devlopement machine it is perfect
[06:08:08] sevenseacat: your first step is probably to go through the production logs and find the emails in question to start verifying that there were in fact two
[06:08:28] arup_r: yes, I will do that
[06:08:34] dopie: sevenseacat, schema working fine now :)
[06:08:57] arup_r: I have no access in production yet, I am n00b that is why :D
[06:10:08] trosborn: has joined #RubyOnRails
[06:11:00] stannard: has joined #RubyOnRails
[06:11:24] linocisco: has joined #RubyOnRails
[06:11:51] dopie: sevenseacat, works perfectly!!!
[06:12:46] sevenseacat: dopie: and you taught us some things about newer features of carrierwave too :)
[06:13:01] tariqc: has joined #RubyOnRails
[06:13:04] GriffinHeart: has joined #RubyOnRails
[06:13:04] dopie: Which ones?
[06:13:16] sevenseacat: mount_uploaders, for one
[06:13:31] sevenseacat: didn't know you could use json fields like that
[06:13:46] Radar: ACTION sighs
[06:13:50] Radar: this build is all Gandalf
[06:13:56] Radar: and by that I mean "YOU SHALL NOT PASS"
[06:16:39] Radar: "Still failing" YES BUILDKITE I KNOW
[06:17:40] aruntomar: has joined #RubyOnRails
[06:18:24] srinidhi: has joined #RubyOnRails
[06:18:26] tariqc: This isn't some technical question, so I'm sorry if this seems too basic but...
[06:18:38] tariqc: Is it encouraged to do automated UI/views testing?
[06:18:47] tariqc: Or is it preferred that you only test models?
[06:20:44] h7br1x_: has joined #RubyOnRails
[06:22:13] Radar: Tariq_: Rails 4 in Action encourages testing the view testing and does not do much with model testing at al.
[06:22:32] sevenseacat: in hindsight I wish we had done a little more model testing.
[06:22:36] sevenseacat: but not much more.
[06:22:39] Radar: Tariq_: I much rather verify that someone can navigate to the login page, enter their email address and their password, then click "Login" and then see that they're logged in
[06:22:53] Radar: Tariq_: I'd rather that over verifying that .authenticated? on the model worked fine.
[06:23:03] mary5030: has joined #RubyOnRails
[06:23:34] sevenseacat: all the unit tests in the world won't save you from dumb mistakes like setting @user in the controller and then trying to use something like @current_user in the view
[06:23:35] tariqc: Alright, so start working on integration testing
[06:23:43] tariqc: I always found integration tests to make more sense than model testing
[06:23:45] sevenseacat: feature tests will
[06:23:55] tariqc: But supposedly they're slow
[06:24:00] sevenseacat: they are indeed
[06:24:35] tariqc: Is it easy to do integration testing with TDD?
[06:24:47] tariqc: (It's hard for me to do TDD anyway, but I just want to know if it is harder)
[06:24:56] Radar: Tariq_: Capybara makes it really easy
[06:25:06] tariqc: That's good to know.
[06:25:55] Radar: Tariq_: Here's that sign in spec I was talking about https://github.com/rubysherpas/r4ia_examples/blob/master/ticketee/spec/features/signing_in_spec.rb#L6-L15
[06:25:57] Radar: It's a really clean API
[06:27:30] tariqc: It certainly is.
[06:27:33] tariqc: I really like it.
[06:27:46] sevenseacat: and its very easy to extend
[06:29:22] ruurd: has joined #RubyOnRails
[06:30:53] annlewis: has joined #RubyOnRails
[06:32:30] iateadonut: has joined #RubyOnRails
[06:33:11] eGGsha: has joined #RubyOnRails
[06:33:13] MaDErroR123: has joined #RubyOnRails
[06:35:14] trosborn: I want to load a different navbar for a subdomain, i.e., for the order subdomain it would load a navbar more relevant to placing an order. Would it be weird to have a simple if statement that checks subdomain, and load the relevant navbar based on that?
[06:35:16] arathald: can someone explain to my why in Ruby, you use self to define a class method instead of an instance method? coming from other languages, self (or this) is used to refer to the current instance of a class, so it seems like this should be the other way around to me
[06:35:53] krz: has joined #RubyOnRails
[06:36:00] arathald: all the resources my google-fu is returning explain that this is the case but don't give any kind of rationale for it
[06:36:42] Radar: arathald: https://gist.github.com/radar/d7200f9e3d2d877dc294
[06:36:55] Radar: arathald: Because when you call those class methods, it's clearer that the method is defined on "self", which is the class.
[06:37:13] arathald: why is self the class, as opposed to an instance of the class?
[06:37:28] arathald: I see self as "current instance of class <x>"
[06:37:33] Radar: I think that's just the decision Matz made and it is what it is.
[06:37:43] artto: has joined #RubyOnRails
[06:38:29] arathald: but doesn't self refer to the current instance of the class in other contexts? like self.edible? would call edible? on the current instance of the class
[06:38:32] workmad3: has joined #RubyOnRails
[06:40:46] trosborn: I think self just refers to the implict receiver of the message. In the case of class methods, the implict receiver is actually an instance of the class Class. Idk if that helps.
[06:41:30] Radar: arathald: inside an instance method it will refer it the instance itself.
[06:41:50] Radar: arathald: def self.foo inside a class is defining a method on the current context's "self", which is the class itself.
[06:41:59] srinidhi: has joined #RubyOnRails
[06:42:00] Radar: because the class (or module, too) is an instance of Class/Module.
[06:43:19] IFrank00: has joined #RubyOnRails
[06:44:08] arathald: https://gist.github.com/arathald/62191c319fa7a9821fdc
[06:45:35] njero: has joined #RubyOnRails
[06:47:26] ych: has joined #RubyOnRails
[06:47:51] arathald: I feel like the semantics are suddenly flipped when you enter a method context :|
[06:49:43] kalusn: has joined #RubyOnRails
[06:50:38] Anubix: has joined #RubyOnRails
[06:51:27] arathald: this may be one thing I just have to remember, even if it doesn't make sense to me. I understand the part of a class being an instance of Class, but I still think it would make sense for the semantics to remain consistent between class and method definitions
[06:51:41] Anubix: Don't u know what to do, when i had 3 deploys with Mina, but i was chaning something on server and deleted postgresql database. Now when i deploy with mina, it writes DB migrations unchanged; skipping DB migration
[06:51:41] Anubix: but true is that database isnt ready
[06:52:16] sevenseacat: arathald: what do you mean, semantics are flipped?
[06:52:32] Anubix: i didnt lost any data, i just had to change locale of database without data and now i have to remigrate it
[06:52:35] adac: has joined #RubyOnRails
[06:52:39] arathald: sevenseacat: did you look at my example?
[06:52:53] sevenseacat: but I don't know what problem you're having with it
[06:53:01] arathald: self refers to the class in a class definition, and to the instance in a method definition
[06:53:21] sevenseacat: self refers to whatever context the method is defined on
[06:53:26] sevenseacat: for class methods, its the class
[06:53:31] sevenseacat: for instance methods, its the instance
[06:53:44] arathald: so in my code, self.expired? calls the method I have defined as expired? and expired? calls the method I have defined as self.expired?
[06:54:10] sevenseacat: only because you're calling expired? in a class method and self.expired? in an instance method
[06:54:24] sevenseacat: you can remove the self. from the self.expired? and it will behave the same
[06:54:32] sevenseacat: or add a self. to expired?
[06:54:40] sevenseacat: the self is implicit in both cases
[06:55:52] sevenseacat: the only time you *need* self is when you want to call setter methods - eg. foo = bar will set a local variable foo, but self.foo = bar will call the foo= setter
[06:56:02] sevenseacat: on the instance
[06:56:57] roller: has joined #RubyOnRails
[06:58:11] n008f4g_: has joined #RubyOnRails
[06:58:36] chouhoulis: has joined #RubyOnRails
[06:58:38] arup_r: and sometimes for readability I use `self` too
[06:59:27] hmsimha: has joined #RubyOnRails
[06:59:32] GriffinHeart: has joined #RubyOnRails
[07:01:16] arathald: it still seems strange to me, but I guess I'll get used to it
[07:02:09] arathald: might make more sense to me when I learn more about how ruby works under the hood too
[07:02:15] comrad: has joined #RubyOnRails
[07:03:02] _lazarevsky: has joined #RubyOnRails
[07:03:14] solars: has joined #RubyOnRails
[07:03:25] SteenJobs: has joined #RubyOnRails
[07:03:28] _lazarevsky: good morning all! I'm trying to nuke a session variable called :start_time but I've been unable to do so
[07:03:37] _lazarevsky: I've tried both session[:start_date] = nil
[07:03:45] _lazarevsky: as well as session.delete(:start_date) to no avail
[07:04:22] helpa: You have not provided enough information to debug your problem. Please provide this information: https://gist.github.com/radar/5384431
[07:04:37] _lazarevsky: I have a function which handles the before_action event in the application controller where I check whether the variable exists and if it doesn't, i set it
[07:04:50] _lazarevsky: ok, let me gist that code
[07:05:32] comrad: has joined #RubyOnRails
[07:06:25] artto: has joined #RubyOnRails
[07:07:05] zpe: has joined #RubyOnRails
[07:09:26] pawnbox: has joined #RubyOnRails
[07:10:23] _lazarevsky: sevenseacat: https://gist.github.com/anonymous/912bf36b597453992a7f
[07:10:30] atrius: has joined #RubyOnRails
[07:10:43] _lazarevsky: the break point in the get_start_time is NEVER called :/
[07:10:52] DEA7TH: has joined #RubyOnRails
[07:11:06] _lazarevsky: whereas the one in the get_end_time gets called whenever I refresh the page which is the expected behaviour
[07:11:30] sevenseacat: and where are you calling get_end_time ?
[07:11:31] aruntomar: has joined #RubyOnRails
[07:12:09] _lazarevsky: sevenseacat: whenever the front-end app has been fully loaded and all javascript promises resolved I send an ajax request to the get_end_time method
[07:12:17] sevenseacat: _lazarevsky: https://gist.github.com/anonymous/912bf36b597453992a7f#file-application_controller-rb-L18 start_date != start_time
[07:13:04] _lazarevsky_: has joined #RubyOnRails
[07:13:34] _lazarevsky_: what can I say.. i'm an idiot
[07:13:58] sevenseacat: I didn't pick up on it when you originally said it either :P
[07:14:10] kwd: has joined #RubyOnRails
[07:14:47] _lazarevsky_: sevenseacat: anyway, thanks!
[07:17:10] MartinElvar: has joined #RubyOnRails
[07:17:19] aganov: has joined #RubyOnRails
[07:20:02] vasilakisFiL: has joined #RubyOnRails
[07:21:28] _lazarevsky_: sevenseacat: do you cache DB data?
[07:21:35] sundhell: has joined #RubyOnRails
[07:21:42] arBmind: has joined #RubyOnRails
[07:21:44] _lazarevsky_: sevenseacat: like say for instance, some data has not changed since the last time it was queried return it from the cache?
[07:22:06] _lazarevsky_: i've noticed that when you add has_one to a serializer
[07:22:17] _lazarevsky_: it sends a separate sql query for every single model
[07:22:46] _lazarevsky_: Team has_one OrgTeam
[07:22:59] _lazarevsky_: in the index method of TeamsController i say -> return as json Team.all
[07:23:17] sevenseacat: because you're not eager loading
[07:23:43] sevenseacat: http://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations
[07:24:09] _lazarevsky_: checking the logs I'm seeing that it runs OrgTeam Load (0.1ms) SELECT "org_teams".* FROM "org_teams" WHERE "org_teams"."team_id" = ? [["team_id", 12]]
[07:24:14] _lazarevsky_: lemme check that
[07:24:58] gasbakid: has joined #RubyOnRails
[07:25:25] _lazarevsky_: sevenseacat: oh my! This is exactly it!
[07:25:50] pawnbox: has joined #RubyOnRails
[07:26:13] yogeshrt: has joined #RubyOnRails
[07:27:54] Cervajz: has joined #RubyOnRails
[07:29:25] techsethi: has joined #RubyOnRails
[07:30:00] Cervajz_: has joined #RubyOnRails
[07:31:51] annlewis: has joined #RubyOnRails
[07:32:02] avelldiroll: has joined #RubyOnRails
[07:32:41] lessless: has joined #RubyOnRails
[07:33:11] seank_: has joined #RubyOnRails
[07:33:55] techsethi: Hi Folks, I am having an issue when passing data for creating the factory object. I am clueless, this is my gist. could someone please check https://gist.github.com/techsethi/b28597616394371fbb3c
[07:34:22] j2FunOnly: has joined #RubyOnRails
[07:35:19] sevenseacat: techsethi: and what does your User model look like
[07:36:59] techsethi: @sevenseacat here it is https://gist.github.com/techsethi/b28597616394371fbb3c
[07:37:45] Ergo: has joined #RubyOnRails
[07:37:46] renews: has joined #RubyOnRails
[07:37:51] artto: has joined #RubyOnRails
[07:37:51] norc: has joined #RubyOnRails
[07:38:01] ruurd: has joined #RubyOnRails
[07:38:04] siddart: has joined #RubyOnRails
[07:38:13] sevenseacat: techsethi: your schema isnt real great, to have both a tc_user and tc_user_id fuield
[07:38:46] norc: Hi, how can I interactively interrogate an ActionPack::Response object?
[07:39:12] norc: *ActionDispatch I mean
[07:39:15] techsethi: correct, @sevenseacat tc_user field is not named correctly. It is basically storing only the "full name" of the user
[07:40:24] sevenseacat: I'd start by renaming the field.
[07:40:57] techsethi: i c. ok. I see your point. @sevenseacat makes sense.
[07:42:04] norc: (I just want to debug the response object to understand better why my tests are failing, and this could be a lot easier if I had an irb shell with the response object present)
[07:42:26] techsethi: norc: have you tried pry ?
[07:42:31] IFrank00: has joined #RubyOnRails
[07:42:34] sevenseacat: sounds like an XY problem
[07:43:07] j2FunOnly: has left #RubyOnRails: ()
[07:43:26] techsethi: norc: an awesome video on pry by the creator. https://www.youtube.com/watch?v=jDXsEzOHb2M very useful for interogeting objects / debugging.
[07:43:29] h7br1x: has joined #RubyOnRails
[07:43:55] sevenseacat: I don't think inspecting a response will tell you why a test is failing
[07:44:05] sevenseacat: the error for the test will, though
[07:44:13] sinkensabe: has joined #RubyOnRails
[07:45:37] K_r3aPeR: has joined #RubyOnRails
[07:46:39] norc: sevenseacat: Well, lets just assume I want to hold the response object in my hands. ;-)
[07:46:47] norc: techsethi: Thanks, I shall take a look at pry. :)
[07:46:48] techsethi: @sevenseacat agree, sounds like an XY probem.
[07:47:04] sevenseacat: norc: then if its a controller spec, you look at `response`
[07:47:28] sevenseacat: but given you've posted exactly zero lines of code, we don't know what you're doing
[07:48:28] norc: sevenseacat: This was just a general question.
[07:48:39] sevenseacat: k, then you have my general answer
[07:49:16] wa_r_ch_i__ld1: has joined #RubyOnRails
[07:49:59] nemo_: has joined #RubyOnRails
[07:50:08] wa_r_ch_i__ld1: I'm trying to use the Bullet gem for the first time, and can't seem to find where to add includes!
[07:50:30] wa_r_ch_i__ld1: does the stacktrace that comes with the N+1 output give any clues where to add it?
[07:50:33] Radar: wa_r_ch_i__ld1: what includes?
[07:51:05] wa_r_ch_i__ld1: @Radar i get back something like N+1 Query detected
[07:51:05] wa_r_ch_i__ld1: Account => [:account_preference]
[07:51:06] wa_r_ch_i__ld1: Add to your finder: :include => [:account_preference]
[07:51:18] wa_r_ch_i__ld1: and I was watching the Railscast on it
[07:51:18] Radar: wa_r_ch_i__ld1: and where are you loading account?
[07:51:30] wa_r_ch_i__ld1: @Radar that's the problem
[07:51:39] wa_r_ch_i__ld1: @Radar I was hoping the stack trace would help me
[07:51:44] wa_r_ch_i__ld1: @Radar but it doesn't look like it
[07:51:51] Radar: wa_r_ch_i__ld1: You literally can't look in your codebase for "Account.find" or "Account.all"?
[07:51:56] wa_r_ch_i__ld1: @Radar and I noticed Ryan's stack trace never led to the controller
[07:52:03] ruurd: has joined #RubyOnRails
[07:52:11] wa_r_ch_i__ld1: @Radar wouldn't it be the current controller action?
[07:52:17] wa_r_ch_i__ld1: @Radar I don;t see it in there
[07:52:28] Radar: wa_r_ch_i__ld1: Neither do I, but that's because you're not slowing down and showing us the code.
[07:52:53] wa_r_ch_i__ld1: @Radar it will be in the stack trace?
[07:53:03] Radar: wa_r_ch_i__ld1: !rule3
[07:53:03] helpa: wa_r_ch_i__ld1: Clearly explain what is happening and create a Gist (http://gist.github.com), (formatted neatly please: http://bit.ly/1q75oia) of the code that is causing the problem you are encountering, as well as any useful output like stacktraces.
[07:53:07] Radar: slow down
[07:53:21] Radar: "omg I must fix this immediately" is not useful to us
[07:53:47] User458764: has joined #RubyOnRails
[07:54:15] arathald: just finished ch2. rspec isn't too bad.
[07:54:18] rhizome: yes, the stacktrace in bullet.log tells you where to look
[07:54:25] armyriad: has joined #RubyOnRails
[07:55:06] wa_r_ch_i__ld1: @rhizome the only controller listed refers to where it renders a template
[07:55:44] atmosx_laptop: has joined #RubyOnRails
[07:56:20] Radar: wa_r_ch_i__ld1: still waiting on that gist
[07:56:36] wa_r_ch_i__ld1: @Radar what should be in the gist?
[07:56:43] Radar: wa_r_ch_i__ld1: ...
[07:56:46] Radar: Let's start with the controller?
[07:56:57] wa_r_ch_i__ld1: @Radar so the controller action currently being used?
[07:57:07] Radar: wa_r_ch_i__ld1: yes.
[07:57:10] w0rd-driven: has joined #RubyOnRails
[07:57:11] wa_r_ch_i__ld1: @Radar ok 1 sec
[07:57:19] wa_r_ch_i__ld1: it def doesnt have straight up Account.all etc
[07:57:21] Aeyrix: Nicks like that make me thank Berners-Lee for tab complete.
[07:57:22] wa_r_ch_i__ld1: but it has a child model
[07:57:37] Linuus: has joined #RubyOnRails
[07:58:07] helpa: http://i.imgur.com/tyViD.gif
[07:59:06] arathald: Aeyrix: gives me a headache skimming the backlog
[07:59:12] Radar: wa_r_ch_i__ld1: If your next message is not a Gist link then I will mute you for 15 minutes.
[07:59:17] chouhoulis: has joined #RubyOnRails
[07:59:19] Aeyrix: it looks like some hangman bot
[07:59:43] AzaToth: has joined #RubyOnRails
[08:01:21] MaDErroR123: has joined #RubyOnRails
[08:01:25] framlinqp: has joined #RubyOnRails
[08:02:12] Radar: ACTION wonders how hard it is to copy+paste some code from $EDITOR, put it into Gist, hit the big green shiny button, and copy+paste a URL sometimes.
[08:02:21] ruurd: has joined #RubyOnRails
[08:02:34] arathald: I'm glad you didn't use scaffolding for ch3+
[08:02:37] sevenseacat: preeeeeeetty hard
[08:02:53] arathald: or the scaffold generator, I should say
[08:02:55] sevenseacat: arathald: we don't use scaffolding anywhere, except in ch1 for the quick demo :)
[08:03:14] Radar: bbl, night time
[08:03:35] wa_r_ch_i__ld1: @Radar http://pastebin.com/dM0KShn5
[08:03:36] arup_r: has joined #RubyOnRails
[08:04:21] wa_r_ch_i__ld1: @Radar http://pastie.org/10492371
[08:04:29] wa_r_ch_i__ld1: because irc doesnt want pastebin
[08:04:43] K_r3aPeR_: has joined #RubyOnRails
[08:04:54] wa_r_ch_i__ld1: so the N+1 from bullet wants me to add an includes of account_preference to Account
[08:05:04] Uo9er_: has joined #RubyOnRails
[08:05:05] arathald: yeah. my initial impression of it was exactly what you say in ch3 - it generates too much crap, which may or may not fit your application, and by the time you sort that bit out, you may as well do it from the ground up and end up with something cleaner
[08:05:09] kalusn: has joined #RubyOnRails
[08:05:10] sevenseacat: can we see the actual full message bullet is giving you?
[08:05:13] arathald: and understand it better to boot :)
[08:05:43] jgt: has joined #RubyOnRails
[08:05:48] wa_r_ch_i__ld1: @arathald N+1 Query detected
[08:05:48] wa_r_ch_i__ld1: Account => [:account_preference]
[08:05:48] wa_r_ch_i__ld1: Add to your finder: :include => [:account_preference]
[08:06:03] arathald: why are you pinging me?
[08:06:11] sevenseacat: that should probably have been pinged at me :P
[08:06:15] sevenseacat: no other information in the log?
[08:06:46] jsrn_: has joined #RubyOnRails
[08:06:54] darutoko: has joined #RubyOnRails
[08:07:41] sevenseacat: I'm not a mindreader, and neither is bullet. it'll tell you where things are happening.
[08:08:31] wa_r_ch_i__ld1: @sevenseacat app/views/posts/detail/_post_type_block.html.erb:9:in `_run_erb_app47views47postss47detail47_post_type_block46html46erb_locals_post_type_block_object'
[08:08:31] wa_r_ch_i__ld1: app/views/posts/detail/_global_content_header.html.erb:1:in `_run_erb_app47views47posts47detail47_global_content_header46html46erb_locals_global_content_header_object'
[08:08:31] wa_r_ch_i__ld1: app/views/posts/detail/_content_header.html.erb:4:in `_run_erb_app47views47posts47detail47_content_header46html46erb_locals_content_header_object'
[08:08:31] wa_r_ch_i__ld1: app/views/posts/detail.html.erb:2:in `_run_erb_app47views47posts47detail46html46erb'
[08:08:36] wa_r_ch_i__ld1: app/controllers/posts_controller.rb:51:in `detail'
[08:08:38] wa_r_ch_i__ld1: app/middleware/flash_session_cookie_middleware.rb:18:in `call'2015-10-19 04:04:23[WARN]
[08:08:40] sevenseacat: !gist blobs of code, don't spam the channel -_-
[08:08:40] helpa: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[08:08:40] wa_r_ch_i__ld1: 0.0.0.0:3000http://0.0.0.0:3000/following/following_labels/print_status?post_id=21914
[08:08:46] nemo__: has joined #RubyOnRails
[08:09:38] nemo___: has joined #RubyOnRails
[08:09:40] arathald: O.o my irc client keeps segfaulting
[08:10:42] wa_r_ch_i__ld1: @sevenseacat http://codepad.org/nQyUcpTN
[08:10:42] nemo_: has joined #RubyOnRails
[08:11:26] wa_r_ch_i__ld1: @sevenseacat when I was checking out Railscasts on bullet, I noticed his stacktrace didn't have the controller he fixed
[08:11:35] wa_r_ch_i__ld1: so i was like, IDK whats going on there
[08:11:47] sevenseacat: so whats on the line referenced on the first line of that code that isnt pasted on gist?
[08:12:49] zpe: has joined #RubyOnRails
[08:12:57] wa_r_ch_i__ld1: @sevensea its the last line here http://pastie.org/10492371
[08:13:01] Aeyrix: wa_r_ch_i__ld1: can you please change your nick
[08:13:04] Aeyrix: before i say something that will get me banned
[08:13:07] yardenbar: has joined #RubyOnRails
[08:13:14] Aeyrix: sorry to sidebar here but god damn
[08:13:16] sevenseacat: it references a view
[08:13:39] sevenseacat: a partial, actually
[08:13:50] sevenseacat: you're making this so much more complicated
[08:13:51] marr: has joined #RubyOnRails
[08:14:03] Aeyrix: you know what's great for multiple files? gist! :v
[08:14:22] sevenseacat: that would require listening to people that ask you to gist things
[08:14:37] wa_r_ch_i__ld1: and a github account
[08:14:38] arathald: that sounds hard
[08:14:40] renegadeandy: has joined #RubyOnRails
[08:14:41] sevenseacat: wa_r_ch_i__ld1: no
[08:14:48] sevenseacat: it does not require a github accounyt
[08:14:49] wa_r_ch_i__ld1: you can gist w/o?
[08:16:09] wa_r_ch_i__ld1: @sevenseacat you can ignore that line
[08:16:16] ezzycreative: has joined #RubyOnRails
[08:16:19] wa_r_ch_i__ld1: when i reloaded the page without a certain param
[08:16:25] wa_r_ch_i__ld1: it still has the n+1 but that line is gone
[08:16:28] sevenseacat: I'm going to ignore this entire problem.
[08:16:46] sevenseacat: its been twenty minutes and you haven't done anything
[08:16:47] wa_r_ch_i__ld1: the first line is really the middleware one
[08:16:54] sevenseacat: so good luck, have fun
[08:17:11] sevenseacat: no, the first line is *not* the middleware one
[08:17:57] blackmesa: has joined #RubyOnRails
[08:18:12] wa_r_ch_i__ld1: https://gist.github.com/anonymous/a77c4a32fb7d80165c30
[08:18:20] wa_r_ch_i__ld1: there is the stack trace and controller action side by side
[08:18:46] wa_r_ch_i__ld1: let me add the N+1 message
[08:20:09] wa_r_ch_i__ld1: @sevenseacat https://gist.github.com/anonymous/7f7f212a69806a8eeb59
[08:20:14] wa_r_ch_i__ld1: so theres the complete edition :)
[08:21:31] sevenseacat: [16:11:47] sevenseacat: so whats on the line referenced on the first line of that code
[08:22:48] wa_r_ch_i__ld1: i thought you meant the stacktrace
[08:23:13] sevenseacat: because thats where the N+1 is coming from.
[08:23:19] wa_r_ch_i__ld1: from the middleware?
[08:23:25] sevenseacat: the *first* line.
[08:23:27] sevenseacat: not the last line.
[08:23:43] sevenseacat: I can see how that might be confusing.
[08:24:46] wa_r_ch_i__ld1: <% if session[:account_settings].subscribe_service && !@post.subscription_number.blank? %>
[08:24:59] _lazarevsky_: sevenseacat: locally i'm experiencing an improvement of .4 seconds after having updated just ONE of the queries!
[08:25:07] sevenseacat: _lazarevsky_: :)
[08:25:09] _lazarevsky_: sevenseacat: in prod we have 48 teams, whereas locally we've got only 8
[08:25:58] yfeldblum: has joined #RubyOnRails
[08:26:23] arup_r: _lazarevsky_: that mean your improved the performance.
[08:26:33] blackmesa: has joined #RubyOnRails
[08:26:36] workmad3: has joined #RubyOnRails
[08:26:39] arup_r: s/your/you
[08:26:48] wa_r_ch_i__ld1: @sevenseacat that line is in a template
[08:26:56] sevenseacat: wa_r_ch_i__ld1: yes, I know.
[08:26:58] Whelton: has joined #RubyOnRails
[08:27:27] yourname1: has joined #RubyOnRails
[08:28:22] wa_r_ch_i__ld1: @sevenseacat i found something like
[08:28:36] wa_r_ch_i__ld1: account.account_preference
[08:28:56] aruntomar: has joined #RubyOnRails
[08:29:00] wa_r_ch_i__ld1: checking the actual file now
[08:29:08] sevenseacat: if that's in a loop, thats a very good candidate for being a N+1 query.
[08:30:18] Peg-leg: has joined #RubyOnRails
[08:30:44] wa_r_ch_i__ld1: @sevenseacat thanks for confirming that the stacktrace is informative, Ill keep digging!
[08:30:58] sevenseacat: wa_r_ch_i__ld1: thats why they show it to you.
[08:31:05] sevenseacat: because thats where the problem is coming from.
[08:31:07] wa_r_ch_i__ld1: i didn't see it help Ryan
[08:31:23] sevenseacat: you didnt show him
[08:31:29] mark2: has joined #RubyOnRails
[08:31:50] wa_r_ch_i__ld1: http://railscasts.com/episodes/372-bullet?autoplay=true
[08:31:58] wa_r_ch_i__ld1: it shows the trace of an N+1
[08:31:59] sevenseacat: oh, that Ryan.
[08:32:09] wa_r_ch_i__ld1: it looks like it does help
[08:32:11] aruntomar: has joined #RubyOnRails
[08:32:12] wa_r_ch_i__ld1: its the template
[08:32:48] annlewis: has joined #RubyOnRails
[08:33:32] FailBit: delete system32
[08:33:57] arathald: to be fair, stacktraces are often *not* helpful :)
[08:35:05] arathald: FailBit: I don't have system32
[08:35:18] ruurd: has joined #RubyOnRails
[08:35:19] FailBit: install gentoo, then
[08:36:08] arathald: I think that's going the opposite direction
[08:37:46] Grundell: has joined #RubyOnRails
[08:39:27] Ropeney: has joined #RubyOnRails
[08:39:38] pawnbox: has joined #RubyOnRails
[08:40:26] adre: has joined #RubyOnRails
[08:40:59] wpp: has joined #RubyOnRails
[08:41:24] zpe: has joined #RubyOnRails
[08:45:18] siaW: has joined #RubyOnRails
[08:45:41] artto: has joined #RubyOnRails
[08:46:27] trosborn: is it a bad practice to have fixture data be similar to seed / production data? e.g., if I am making a pizza ordering system, would it be okay to have a pizza with name ???pepperoni??? in my fixtures, or should I name it something like ???earwax????
[08:47:03] FailBit: what do _you_ think?
[08:47:23] FailBit: I made most of my fixtures by taking real production data
[08:47:45] wpp: trosborn It is probably a better idea to have it similar to production data
[08:48:42] trosborn: Okay. I ask because when I took a Rails class, our teachers told us to use weird data in fixtures to not confuse it with real data, but that seems bizarre in hindsight.
[08:48:44] trosborn: Thank you :)
[08:48:59] vigintas: has joined #RubyOnRails
[08:49:36] wpp: trosborn perhaps they were just using weird data for testing edge cases in the code?
[08:50:05] trosborn: No, it was weird in name only, it didn???t contain anything that would check for edge cases.
[08:50:41] nemo_: has joined #RubyOnRails
[08:51:30] raunicolae: has joined #RubyOnRails
[08:52:00] jgt: has joined #RubyOnRails
[08:52:00] FailBit: then no, you probably shouldn't do that
[08:53:11] pawnbox: has joined #RubyOnRails
[08:55:29] pawnbox: has joined #RubyOnRails
[08:59:06] RickJamesTheThir: has joined #RubyOnRails
[08:59:40] RickJamesTheThir: Hi ladies and gents
[08:59:48] dawidof: has joined #RubyOnRails
[08:59:55] RickJamesTheThir: I was hoping someone could help me refractor a small snippet of code
[08:59:57] wpp: Hello, does someone here have experience with rbtrace and debugging memory leaks? I'm following http://samsaffron.com/archive/2015/03/31/debugging-memory-leaks-in-ruby and I'm trying to make a unicorn worker dump its heap. But I keep getting "timed out waiting for eval response"
[09:00:01] chouhoulis: has joined #RubyOnRails
[09:00:31] RickJamesTheThir: I'm trying to make it so that I can find all connecting flights and I have the logic in place its just redundant
[09:00:33] RickJamesTheThir: https://gist.github.com/markscoin/c74558b5abb204575de1
[09:01:13] RickJamesTheThir: it can only go up to 2 connecting flights right now but I feel like it should be a loop based on if there is more flights available
[09:01:31] RickJamesTheThir: it works by creating a new instance Connection.new("Berlin","Madrid").find
[09:01:40] Cervajz: has joined #RubyOnRails
[09:01:46] RickJamesTheThir: it would show you all the flights that get you from Berlin to Madrid
[09:01:53] RickJamesTheThir: including connecting flights
[09:02:28] Spami: has joined #RubyOnRails
[09:03:20] mauro23051983: has joined #RubyOnRails
[09:05:28] weckl: has joined #RubyOnRails
[09:05:54] renews: has joined #RubyOnRails
[09:06:28] krz: has joined #RubyOnRails
[09:06:34] siddart: has joined #RubyOnRails
[09:07:07] draken: what is the difference been using stylesheet_link_tag to include a css and just plopping the good old html that does it ?
[09:07:30] rvanlieshout: draken: the fact that your html should not contain style
[09:07:31] wpp: ok looks like there is a --timeout argument but that is only available on rbtrace master (not in 0.4.7)
[09:07:44] mauro23051983: Hi guys, I have a question about STI. I have a model UserRequest and then several sub classes RequestA, RequestB, ... I'm currently using STI. The problem is that now I need to store in the DB data for each Request Type. Ho can I do that?
[09:08:15] freezevee: has joined #RubyOnRails
[09:08:23] rvanlieshout: mauro23051983: why do you want to use STI?
[09:08:41] mauro23051983: Because they sahre the same schema
[09:08:44] draken: well i mean just including the css without ruby
[09:09:00] rvanlieshout: draken: ah right.. the asset precompile thing
[09:09:01] mauro23051983: But I need to define different recipients for notifications.
[09:09:05] rvanlieshout: rails will precompile them on production
[09:09:11] rvanlieshout: and that has several advantages
[09:09:19] rvanlieshout: written in the guides :)
[09:09:36] dawidof: Hello, I want to save nested model and then make some actions with current model. Now I've got after_commit, but it firstly runs after_commit and then saves nested model. Example https://gist.github.com/dawidof/7f9f248e3faef6a537be
[09:09:55] draken: ahh thanks
[09:10:18] fcser_: has joined #RubyOnRails
[09:11:21] atomical: has joined #RubyOnRails
[09:13:23] Puffball: has joined #RubyOnRails
[09:14:12] targaf: has joined #RubyOnRails
[09:15:06] h7br1x: has joined #RubyOnRails
[09:16:24] DEA7TH: has joined #RubyOnRails
[09:18:10] nemo__: has joined #RubyOnRails
[09:18:26] mauro23051983: rvanlieshout: any idea?
[09:19:45] renegadeandy: has joined #RubyOnRails
[09:21:08] raunicolae: has left #RubyOnRails: ("Once you know what it is you want to be true, instinct is a very useful device for enabling you to know that it is")
[09:23:09] xybre: has joined #RubyOnRails
[09:27:04] aruntomar_: has joined #RubyOnRails
[09:28:01] zpe_: has joined #RubyOnRails
[09:28:17] cornerma1: has joined #RubyOnRails
[09:28:18] chrislotix: has joined #RubyOnRails
[09:28:23] arup_r: mauro23051983: your problem is ?
[09:29:36] alcipir: has joined #RubyOnRails
[09:31:57] mauro23051983: arup_r: I have a question about STI. I have a model UserRequest and then several sub classes RequestA, RequestB, ... I'm currently using STI. The problem is that now I need to store in the DB data for each Request Type. Ho can I do that?
[09:32:02] arup_r: I don't get what you don't get. Anyway to use STI, you must need to have a 'type' column. and you will be creating object of child classes like RequestA.new(..)
[09:32:05] krisquigley: has joined #RubyOnRails
[09:32:29] arup_r: mauro23051983: I read that. But didn't get, what is stopping you. :)
[09:32:31] youngbaks: has joined #RubyOnRails
[09:32:51] htmldrum: has joined #RubyOnRails
[09:32:54] mauro23051983: I need to define notification recipients for each request type.
[09:33:33] annlewis: has joined #RubyOnRails
[09:33:42] mauro23051983: Is it possible, in STI, to move the type column to another table?
[09:33:57] User458764: has joined #RubyOnRails
[09:34:06] seank_: has joined #RubyOnRails
[09:34:29] sppp: has joined #RubyOnRails
[09:35:28] arup_r: No, why need to move the type column. You could create associations indeed
[09:35:35] mauro23051983: I could also define UserRequest & UserRequestType models, association between the two
[09:35:58] arup_r: recipients are Users right ?
[09:35:59] mauro23051983: How can I define UserRequest sublcasses based on the relation ?
[09:36:13] mauro23051983: Recipients are email addresses
[09:36:49] arup_r: they are alays emails addresses ?
[09:37:04] mauro23051983: User of course receive an email, but also a person in charge of managing these requests
[09:37:23] mauro23051983: And according to the type of the request, the person in charge of managing it changes
[09:37:33] arup_r: What is the DBMS you are using ?
[09:37:39] arup_r: Postgresql ?
[09:38:18] dawidof: need help!
[09:38:35] arup_r: ok. Create a users field as a text and then store the recipients emails as a Array inside the column by doing serialization
[09:39:01] WhereIsMySpoon_: has joined #RubyOnRails
[09:39:32] workmad3: has joined #RubyOnRails
[09:39:44] arup_r: The field should be added to the Parent table "UserRequest"
[09:39:49] arup_r: mauro23051983: ^^
[09:41:22] bonhoeffer: has joined #RubyOnRails
[09:43:35] mauro23051983: arup_r: in UserRequest there is a filed user_id, user email address can be easily extracted
[09:44:09] mauro23051983: arup_r: recipients for a request type does not change over requests, I dont want to save the same value multiple times
[09:44:10] arup_r: ok. That is what I asked you, if you have any association.
[09:44:18] arup_r: then you don't the users column
[09:44:25] MartinEl_: has joined #RubyOnRails
[09:44:40] mauro23051983: User <- UserRequest
[09:44:55] arup_r: I am confused now.
[09:44:55] mauro23051983: a UserRequests belongs to a User
[09:45:44] rodfersou: has joined #RubyOnRails
[09:45:51] arup_r: so what is wrong..
[09:45:54] mauro23051983: arup_r: a user perform a request, I want to be able to define who is in charge of requests of each type
[09:46:38] pawnbox: has joined #RubyOnRails
[09:46:46] mauro23051983: But I also want to define UserRequest subclasses in order to have a better implementation.
[09:46:52] arup_r: ok. So what is the problem to use the user_id you have
[09:46:58] mauro23051983: STI let you easily have subclasses
[09:47:12] futilegames: has joined #RubyOnRails
[09:47:20] arup_r: You have user_id already, you can use it
[09:47:30] mauro23051983: But I don't want a column type, I need to have a relation because I neet to save recipents per RequestType
[09:48:55] dhjondoh: has joined #RubyOnRails
[09:49:12] mauro23051983: Launch time, see you later :)
[09:50:16] arup_r: mauro23051983: seems like easy to solve problem. but communication gap making hard
[09:50:28] arup_r: dawidof: hi
[09:50:41] gasbakid: has joined #RubyOnRails
[09:50:57] dawidof: arup_r, hi
[09:53:14] arup_r: go ahead, dawidof please :D
[09:53:52] workmad3: has joined #RubyOnRails
[09:54:18] futilegames: has joined #RubyOnRails
[09:54:25] Cervajz__: has joined #RubyOnRails
[09:57:41] dawidof: arup_r, added more files to gist
[09:58:37] roxtrongo: has joined #RubyOnRails
[09:58:48] MartinElvar: has joined #RubyOnRails
[10:00:34] njero: has joined #RubyOnRails
[10:00:50] chouhoulis: has joined #RubyOnRails
[10:02:29] Spami: has joined #RubyOnRails
[10:04:34] renegadeandy: has joined #RubyOnRails
[10:05:12] U7se6: has joined #RubyOnRails
[10:06:43] pawnbox: has joined #RubyOnRails
[10:10:25] lessless: has joined #RubyOnRails
[10:11:33] bonhoeffer: has joined #RubyOnRails
[10:13:16] yashinbasement: has joined #RubyOnRails
[10:17:30] eGGsha: has joined #RubyOnRails
[10:18:12] gautam: has joined #RubyOnRails
[10:18:35] FailBit: http://wtop.com/health/2015/10/woman-mistakenly-glues-her-eye-shut-with-super-glue/
[10:19:03] chrislotix: How do symbols as hash keys allow quicker access compared to strings?
[10:19:10] FailBit: chrislotix: they don't
[10:19:25] FailBit: lookups in ruby hashes are best-case O(1) and worst-case O(n)
[10:19:34] FailBit: the average case is O(n log n) because b-tree
[10:19:49] FailBit: er, O(log n)
[10:20:17] FailBit: the worst case is for very small hashes because instead of placing them in the global hash table they are actually arrays in MRI
[10:20:26] BaNzounet: Does fixture load all relations? like foo.bar.foobar.name will work out of the box? Because I've created serveral fixtures, and when Ido foo.bar.foobar.name I get an error saying 'undefined method `name' for nil:NilClass'
[10:20:27] rickmasta: has joined #RubyOnRails
[10:20:55] chrislotix: okay i see thanks
[10:20:59] BaNzounet: And when I do foo.bar.to_json I can see an id for foobar_id
[10:21:05] gasbakid: has joined #RubyOnRails
[10:21:17] chrislotix: weird for the wiki to state that
[10:21:30] greenride: FailBit: Those complexity numbers are just wrong.
[10:22:11] chrislotix: greenride, can you elaborate? i'd be happy to hear
[10:22:54] greenride: chrislotix: One sec... let me get source (with code to prove).
[10:23:41] chrislotix: greenride, take your time
[10:25:11] greenride: http://www.amazon.com/reader/1593275277?_encoding=UTF8&query=After%20disabling%20garbage%20collection%20to%20avoid
[10:25:25] greenride: You might need to sign in to amazon.
[10:25:51] greenride: Code is on page 170
[10:25:53] gasbakid: has joined #RubyOnRails
[10:26:11] greenride: My version of the book has the graph on pg 173 and the code on pg 172
[10:26:29] siaW: has joined #RubyOnRails
[10:26:30] FailBit: do us a favor and copy the complexities
[10:26:40] FailBit: because not all of us have an amazon account
[10:27:07] greenride: Average case is O(1)
[10:27:23] greenride: Best case is obviously O(1)
[10:28:25] FailBit: clearly I was wrong about my average
[10:28:36] FailBit: the bounds that I put forth stand
[10:29:05] ekem: i think amazon mislinked the editorial review there
[10:29:06] FailBit: and the worst case comes up more often than one might expect but the effect is in most cases negligible
[10:29:19] ekem: From School Library Journal
[10:29:19] ekem: Gr 10 Up???A thorough (but flawed) look at Internet protection aimed squarely at female users. There is a battle to be fought, and the author intends to arm the female population...
[10:29:44] workmad3: FailBit: also, the complexity class hides a small detail - hashes for symbols are faster to calculate than for strings
[10:29:57] greenride: Even with hash collisions, worst case is not O(n).
[10:30:25] Jasaka: has joined #RubyOnRails
[10:30:33] greenride: Actually, I'm not sure about the worst case.
[10:31:08] techsethi: Hi Folks, could someone please point me to some good open-source rails applications that would help someone a beginner or intermediate person to understand how to structure a rails application. I am especially interested in knowing how to use custom classes in a medium size rails application / what are good OO practices in a rails application. Thanks much in advance.
[10:31:09] workmad3: greenride: the worst-case sounded right to me, as the worst-case is all the provided values hashing to the same modulo value and being stored in an array
[10:31:12] FailBit: so what the heck are Symbol#hash and String#hash
[10:33:54] workmad3: FailBit: the difference is pretty negligible btw, but it's still present... symbol - 0.690000 0.000000 0.690000 ( 0.690788) vs string - 0.870000 0.000000 0.870000 ( 0.880371)
[10:34:00] FailBit: https://github.com/ruby/ruby/blob/832c74f428db6c5bd6e575e1f6ea7fe0891c84d2/symbol.c#L529
[10:34:03] workmad3: that's timing over 10 million calls of `hash`
[10:34:09] greenride: workmad3: Ruby rebalances in the case that provided values hash to the same modulo value. As a result, hash lookups are faster, but insertions could be slower.
[10:34:14] FailBit: Symbol hash is generated during alloc
[10:34:16] annlewis: has joined #RubyOnRails
[10:34:54] workmad3: greenride: ah, fair enough (I really should read RUAM)
[10:35:09] FailBit: https://github.com/ruby/ruby/blob/832c74f428db6c5bd6e575e1f6ea7fe0891c84d2/string.c#L9197
[10:35:18] FailBit: string hash is generated on call
[10:35:29] FailBit: that's the only reason why
[10:35:33] greenride: workmad3: It's surprisingly well written... not as hard to read as one might think.
[10:35:47] workmad3: greenride: I know... it's on my reading list, I just haven't gotten around to it yet :)
[10:36:16] greenride: I haven't read the whole book either.
[10:36:22] FailBit: greenride: do you see why symbol hash lookups are faster?
[10:37:09] greenride: FailBit: I wasn't following that thread of conversation... reading
[10:37:15] G: has joined #RubyOnRails
[10:38:23] ldnunes: has joined #RubyOnRails
[10:38:29] greenride: FailBit: sortof.... it's only a constant factor slower.
[10:38:40] greenride: what was the claim?
[10:39:11] FailBit: Symbol hash is generated during alloc, string hash is generated on call
[10:39:45] FailBit: not only that, but symbols aren't gc'd
[10:39:46] netzfisch: has joined #RubyOnRails
[10:39:53] FailBit: well, not as frequently as strings
[10:39:58] weihan: has joined #RubyOnRails
[10:40:14] FailBit: symbol literals are never gc'd so if you tested with that, try again with one generated by to_sym
[10:41:02] greenride: http://www.infoq.com/news/2014/12/ruby-2.2.0-released
[10:41:04] GriffinHeart: has joined #RubyOnRails
[10:41:09] workmad3: FailBit: GC isn't an issue in the test I was running, as I stashed the string in a local outside the benchmark block
[10:42:00] mrbubbles: has joined #RubyOnRails
[10:42:07] FailBit: greenride: symbol literals are never gc'd
[10:42:25] greenride: Which version of Ruby?
[10:42:52] FailBit: literals are allocated once and reused throughout the program
[10:43:09] montagesoftware: has joined #RubyOnRails
[10:43:09] FailBit: strings otoh are allocated every time the parser sees it
[10:43:14] greenride: http://www.sitepoint.com/symbol-gc-ruby-2-2/
[10:44:04] FailBit: greenride: see section about immortals
[10:44:05] Pavster: has joined #RubyOnRails
[10:44:11] FailBit: those include symbol litetals
[10:44:48] platzhirsch: has joined #RubyOnRails
[10:45:02] workmad3: FailBit: any idea if a symbol like `:"#{foo}bar"` is mortal or immortal?
[10:45:37] h7br1x: has joined #RubyOnRails
[10:46:18] greenride: unless it's assigned to a method name
[10:47:09] wethu: has joined #RubyOnRails
[10:48:00] blackmesa: has joined #RubyOnRails
[10:48:47] workmad3: greenride: ah, so it is :)
[10:49:01] workmad3: good to know there isn't an obvious way to introduce symbol leakage
[10:49:22] patrick_f: has joined #RubyOnRails
[10:50:09] platzhirsch: Any idea when Rails 5 will be released?
[10:50:30] workmad3: platzhirsch: nope
[10:50:47] Jasaka: has joined #RubyOnRails
[10:50:54] platzhirsch: http://rails5countdown.com/
[10:50:54] workmad3: platzhirsch: I'd anticipate 2-3 months after the first beta, going by historical trends
[10:51:00] platzhirsch: ACTION chuckles
[10:51:29] workmad3: up until that first beta drop though... your countdown is as good as any estimate ;)
[10:51:54] guidohcosta: has joined #RubyOnRails
[10:51:59] yogeshrt: has joined #RubyOnRails
[10:52:01] greenride: workmad3: I take that back about your example. It depends on the context in which it is used.
[10:52:37] greenride: workmad3: If it's used in a dynamic method definition, it's possible that it won't be garbage collected.
[10:53:02] workmad3: greenride: fun :)
[10:54:12] workmad3: platzhirsch: sorry, historical trend == about 4 months from beta to release (also, I don't anticipate rails 5 reaching final release this year now)
[10:54:29] platzhirsch: workmad3: yeah, that's fair enough..
[10:57:17] workmad3: platzhirsch: it's fun looking @ the time spent from beta to stable release in rubygems though :) counting from rails 3 (as that was a big change in the way rails was organised and managed, so prior data is probably invalid), we have 8 months for 3.0, just under 4 months for 3.1, a super-fast 2 months for 3.2 (no betas though, started with rc1), then 4 months for 4.0, 4.1 and 4.2
[10:57:37] aruntomar: has joined #RubyOnRails
[10:57:44] cleopatra: has joined #RubyOnRails
[10:59:08] stamina: has joined #RubyOnRails
[10:59:27] platzhirsch: workmad3: maybe that's a better estimation then
[11:00:39] zpe: has joined #RubyOnRails
[11:00:42] artto: has joined #RubyOnRails
[11:01:35] chouhoulis: has joined #RubyOnRails
[11:04:40] shmilan: has joined #RubyOnRails
[11:04:47] Jasaka: has joined #RubyOnRails
[11:05:05] blackmesa: has joined #RubyOnRails
[11:05:27] chills42: has joined #RubyOnRails
[11:05:52] guidohcosta_: has joined #RubyOnRails
[11:05:56] zpe: has joined #RubyOnRails
[11:06:35] adac: has joined #RubyOnRails
[11:07:06] roxtrongo: has joined #RubyOnRails
[11:08:58] sevenseacat: has joined #RubyOnRails
[11:09:25] codelahoma: has joined #RubyOnRails
[11:10:06] nemo_: has joined #RubyOnRails
[11:14:39] nemo_: has joined #RubyOnRails
[11:15:22] Linuus: has joined #RubyOnRails
[11:16:30] trosborn: has joined #RubyOnRails
[11:17:55] johnflux: has joined #RubyOnRails
[11:17:56] johnflux: has joined #RubyOnRails
[11:19:43] seank_: has joined #RubyOnRails
[11:20:58] ivanyk: has joined #RubyOnRails
[11:21:05] pawnbox: has joined #RubyOnRails
[11:21:41] lipoqil: has joined #RubyOnRails
[11:21:45] pawnbox: has joined #RubyOnRails
[11:28:36] chills42: has joined #RubyOnRails
[11:29:25] MaDErroR123: has joined #RubyOnRails
[11:30:45] Whelton: has joined #RubyOnRails
[11:30:58] darrencauthon: has joined #RubyOnRails
[11:31:08] yogeshrt: has joined #RubyOnRails
[11:31:24] MaDErroR123: has joined #RubyOnRails
[11:31:48] mxrguspxrt: has joined #RubyOnRails
[11:32:06] nemo_: has joined #RubyOnRails
[11:32:40] blackmesa: has joined #RubyOnRails
[11:33:42] nettoweb: has joined #RubyOnRails
[11:33:49] nettoweb: guys I have installed nginx with "passenger-install-nginx-module" on CentOS but now Im planning to upgrade nginx to 1.9.5 to get HTTP2 support. Im wonder I do this because I nginx was installed via Passenger.
[11:34:04] dhjondoh: has joined #RubyOnRails
[11:34:32] krz: has joined #RubyOnRails
[11:35:08] nya: has joined #RubyOnRails
[11:35:09] annlewis: has joined #RubyOnRails
[11:35:14] HoloIRCUser: has joined #RubyOnRails
[11:38:29] youngbaks: has joined #RubyOnRails
[11:40:00] zpe: has joined #RubyOnRails
[11:42:14] Pumukel: has joined #RubyOnRails
[11:43:00] johnflux: has joined #RubyOnRails
[11:43:01] johnflux: has joined #RubyOnRails
[11:45:45] Jon30: has joined #RubyOnRails
[11:47:06] njero: has joined #RubyOnRails
[11:47:36] nickenchuggets: has joined #RubyOnRails
[11:50:19] smathy: has joined #RubyOnRails
[11:53:05] zpe: has joined #RubyOnRails
[11:54:14] unreal: has joined #RubyOnRails
[11:55:11] Icey: has joined #RubyOnRails
[11:56:43] sinkensabe: has joined #RubyOnRails
[11:59:22] armyriad: has joined #RubyOnRails
[12:01:30] curses: has joined #RubyOnRails
[12:02:16] AugustoCesar: has joined #RubyOnRails
[12:02:19] chouhoulis: has joined #RubyOnRails
[12:04:46] guidohcosta: has joined #RubyOnRails
[12:05:17] Uo9er_: has joined #RubyOnRails
[12:05:40] atomical: has joined #RubyOnRails
[12:07:45] toy: after_create is not calling the methods ..but object gets created
[12:08:04] toy: any help on this
[12:08:38] mostlybadfly: has joined #RubyOnRails
[12:08:42] hmsimha: has joined #RubyOnRails
[12:12:40] moeabdol: when configuring omniauth in a rails application, does the callback from the omniauth provider trigger a post request or is it another rest request?
[12:12:52] moeabdol: I???m guessing its a post since ???mI getting back an omniauth hash!
[12:12:54] siddart: has joined #RubyOnRails
[12:13:20] moeabdol: I???m guessing its a post since I'm getting back an omniauth hash!
[12:13:25] aruntomar: has joined #RubyOnRails
[12:16:02] darrencauthon: has joined #RubyOnRails
[12:17:01] big|bad|wolf: has joined #RubyOnRails
[12:17:23] saimancroy: has joined #RubyOnRails
[12:18:14] Skizu: has joined #RubyOnRails
[12:18:39] aruntomar: has joined #RubyOnRails
[12:19:30] Skizu: How do I have modal based upon constants? For example, permissions I want to be constants, but I want a user_permissions table?
[12:21:24] big|bad|wolf: has joined #RubyOnRails
[12:22:04] aruntomar: has joined #RubyOnRails
[12:22:50] paolodoors: has joined #RubyOnRails
[12:23:15] alphaatom: has joined #RubyOnRails
[12:23:16] nemo_: has joined #RubyOnRails
[12:23:24] Anubix: has joined #RubyOnRails
[12:23:45] Anubix: Hi, don't you know how i can in ubuntu find path of file ?
[12:23:46] arup_r: has joined #RubyOnRails
[12:24:51] Skizu: on the cli use locate
[12:25:28] weihan_: has joined #RubyOnRails
[12:26:45] weihan: has joined #RubyOnRails
[12:27:00] mices: bcrypt stores a password as a hash yes?
[12:27:26] MaDErroR123: has joined #RubyOnRails
[12:27:27] Skizu: has left #RubyOnRails: ()
[12:27:41] Anubix: Skizu: I did SSL settings on server and i can't locate my website_com.key
[12:27:55] weihan: has joined #RubyOnRails
[12:29:53] tbuehlmann: mices, it takes a password and creates a hash out of it
[12:30:17] mices: tbuehlmann: does it encrypt it first?
[12:30:47] mices: or the encryption is just because it's been hashed
[12:31:16] tbuehlmann: there's no encryption, it's a hashing algorithm
[12:31:23] weihan: has joined #RubyOnRails
[12:31:52] mices: so the hash would have one element a name value pair like password="..."
[12:32:32] tbuehlmann: not sure you internalized the idea behind it
[12:32:46] tbuehlmann: you don't store passwords in your database, you store hashes of passwords
[12:33:17] tbuehlmann: when a user tries to login, you check if there's a hash for the password that was typed in
[12:34:46] lea: has joined #RubyOnRails
[12:35:09] joshkovach: has joined #RubyOnRails
[12:35:43] mices: i'm reading section 8.4.2 of railstutorial.org/book
[12:35:57] annlewis: has joined #RubyOnRails
[12:36:24] aruntomar: has joined #RubyOnRails
[12:37:04] weihan: has joined #RubyOnRails
[12:38:16] weihan: has joined #RubyOnRails
[12:39:14] youngbaks: has joined #RubyOnRails
[12:40:14] zpe: has joined #RubyOnRails
[12:42:25] nurbson: has joined #RubyOnRails
[12:43:26] Linuus: has joined #RubyOnRails
[12:44:43] IrishGringo: has joined #RubyOnRails
[12:45:06] mices: tbuehlmann: here's what's not clear to me, the author shows this code 'BCrypt::Password.new(remember_digest) == remember_token` which i thought i understood but the right below it he says "If you think about it, this code is really strange: it appears to be comparing a bcrypt password digest directly with a token, which would imply decrypting the digest in order to compare using ==. But
[12:45:06] mices: the whole point of using bcrypt is for hashing to be irreversible, so this can???t be right" so that's where he loses me i dunno what he's talking about
[12:46:05] jtb__: has joined #RubyOnRails
[12:46:19] techsethi: has joined #RubyOnRails
[12:46:37] adac: has joined #RubyOnRails
[12:47:14] tbuehlmann: yeah, one could think that
[12:47:14] nurbson: hi renegadeandy
[12:47:21] tbuehlmann: have a look at the method definition: https://github.com/codahale/bcrypt-ruby/blob/1f9184a8df2b90fa02d01a32a364eefc9072e1b9/lib/bcrypt/password.rb#L65-L67
[12:47:34] pydave6367: has joined #RubyOnRails
[12:47:45] weihan: has joined #RubyOnRails
[12:48:17] nurbson: your comment on my gist https://gist.github.com/nurbs999/3868e1d236776c8994ce worked, but I have problems setting the institution at ArticlesController#create action
[12:49:10] tvw: has joined #RubyOnRails
[12:49:26] tagrudev: has joined #RubyOnRails
[12:50:29] FastJack: has joined #RubyOnRails
[12:53:53] mices: tbuehlmann: he says also that if you look at the definition == is redefined to is_password? but big deal, is_password? means the same thing
[12:53:59] nandx64: has joined #RubyOnRails
[12:55:03] tbuehlmann: the book is outdated or flawed then
[12:55:23] tbuehlmann: it's the same method. if you look at the definition, it should be clear what happens
[12:55:43] mices: i think i need to read the definition of is_password?
[12:56:19] ramortegui: has joined #RubyOnRails
[12:57:16] jkamenik: has joined #RubyOnRails
[12:58:07] mices: tbuehlmann: is_password? is hashing the token and then comparing it with BCrypt::Password.new(remember_digest) ?
[12:59:19] Fire-Dragon-DoL: has joined #RubyOnRails
[13:00:02] krisquigley: has joined #RubyOnRails
[13:00:07] basiles: has joined #RubyOnRails
[13:00:15] Avon: has joined #RubyOnRails
[13:00:33] tbuehlmann: right. and the way you call it, one could think it's decrypting the hash and comparing _that_ with the input
[13:00:37] tbuehlmann: but that's not the case
[13:00:41] Voxxit: has joined #RubyOnRails
[13:01:21] symbol: has joined #RubyOnRails
[13:01:22] krisquig_: has joined #RubyOnRails
[13:02:45] mices: tbuehlmann: ty
[13:03:04] chouhoulis: has joined #RubyOnRails
[13:03:07] wethu: has joined #RubyOnRails
[13:03:39] jbrinkmusic: can someone help me understand what I've done wrong and how to make this code work: http://pastie.org/private/snjdwjefwo34s4snlmz6w
[13:04:37] patrick_f: has joined #RubyOnRails
[13:04:40] jbrinkmusic: j is an array with JSON objects that have project information
[13:05:14] daffy_duck: has joined #RubyOnRails
[13:05:21] jbrinkmusic: or basically an array of arrays since the JSON has already been read into an array earlier
[13:06:04] nurbson: jbrinkmusic: what error do you get?
[13:06:10] n1lo: has joined #RubyOnRails
[13:06:39] darrencauthon: has joined #RubyOnRails
[13:06:41] Cervajz: has joined #RubyOnRails
[13:06:57] jbrinkmusic: nurbson: a bunch of syntax errors with "unexpected keyword_elsif elsif plannings.coun >= buildings... ^" etc
[13:07:32] jbrinkmusic: ignore my typo on plannings.count
[13:07:37] tvon: has joined #RubyOnRails
[13:08:17] jbrinkmusic: I can make another pastie from the error log
[13:09:23] nurbson: yes, please
[13:09:55] jbrinkmusic: nurbson: http://pastie.org/private/7vzuhsrzixibek0hsogrg
[13:10:35] nickjj_: has joined #RubyOnRails
[13:11:01] mices: tbuehlmann: but the problem still is the author's saying the first syntax is usable to, before the replacement of == with is_password?
[13:11:42] mices: he's saying we use the is_password? syntax only because it's preferable because it's meaning is clearer
[13:12:09] loren: has joined #RubyOnRails
[13:12:21] mices: if we don't hash the token, how can we compare it to a hash using ==
[13:12:22] orolo: has joined #RubyOnRails
[13:12:54] mices: or compare it to bcrypt acting on a hash
[13:13:11] jbrinkmusic: nurbson: I suspect the error is caused by my .each do loops inside the if statements but I don't know how to do this better without having to write the middle block again 4 times
[13:13:27] nurbson: you problem is this line: <% ideas.each do |idea| %>
[13:13:47] nandx64: has joined #RubyOnRails
[13:13:54] nurbson: it starts a new block which needs to be closed before you can elsif to the next case
[13:14:20] cswelin: has joined #RubyOnRails
[13:15:00] matthewd: jbrinkmusic: Consider that your loop only needs to count up to the highest index in one of the arrays
[13:15:07] arup_r: do we have anything like collection_check_boxes_tag ?
[13:15:09] jbrinkmusic: exactly... now, I'm almost certain there is a better way to do this... I could fix this by writing what comes after 4 times in each if/elsif/else block but it's very ugly
[13:15:29] vasilakisFiL: which api endpoint would you prefer for confirming an email? /api/v1/users/:id/email_confirm/:token /api/v1/users/:id/email_confirm?token=:token, /api/v1/users/email_confirm/:token or /api/v1/users/email_confirm?token=:token ?
[13:16:13] sankaber: has joined #RubyOnRails
[13:16:14] jbrinkmusic: matthewd: is there another way to test which array is the biggest and only do the each loop once with that array?
[13:16:54] loren321: has joined #RubyOnRails
[13:17:08] matthewd: jbrinkmusic: You don't need to do the loop with an array; you're not using it. You can just do a numeric loop.
[13:18:11] nandx64: has joined #RubyOnRails
[13:18:25] sinkensabe: has joined #RubyOnRails
[13:19:10] jbrinkmusic: matthewd: do you mean I just replace my each loops with while x <= phase.count ?
[13:19:41] matthewd: jbrinkmusic: I was thinking more like `N.times do |x|`, but yeah.
[13:20:03] arup_r: nvm, I figured it out
[13:23:57] jbrinkmusic: matthewd: the problem still remains how do I get which array has the highest .count?
[13:24:02] adac: has joined #RubyOnRails
[13:24:46] alphaatom: has joined #RubyOnRails
[13:26:24] matthewd: jbrinkmusic: Right... but restated, isn't that problem a bit easier? "How do I find the highest of 5 integers?"
[13:26:55] nettoweb: any help about nginx update to get http2?
[13:27:19] nettoweb: using passenger-install-nginx-module
[13:28:49] jbrinkmusic: matthewd: I fixed it by testing through all the arrays if they are the highest but it feels like there should be a shorter way to achieve this... or maybe I'm wrong, at least it works
[13:28:58] h7br1x: has joined #RubyOnRails
[13:29:50] matthewd: jbrinkmusic: [ideas.count, plannings.count, buildings.count, ..].max
[13:29:59] pusewicz: has joined #RubyOnRails
[13:30:12] jbrinkmusic: matthewd: thank you, that's much better
[13:30:14] matthewd: or even [ideas, plannings, ..].map(&:count).max
[13:30:17] aruntomar: has joined #RubyOnRails
[13:31:05] pusewicz: In the past (Rails 4.1) I had `DELETE FROM #{relation.table_name} #{relation.where_sql} LIMIT #{limit}` and relation.where_sql used to work. Now (Rails 4.2) it returns WHERE id = ? rather than substituted sql
[13:31:17] pusewicz: is there a way around it? I tried using the DeleteManager directly, but no luck
[13:32:01] jbrinkmusic: matthewd: perfect, thank you :)
[13:32:27] matthewd: pusewicz: Model.where(id: relation.limit(limit)).delete_all ?
[13:32:36] pusewicz: Yeah, that's fine
[13:32:47] eGGsha: has joined #RubyOnRails
[13:32:53] pusewicz: I'm talking about the particular example, with where_sql
[13:33:04] sevenseacat: has joined #RubyOnRails
[13:33:46] voker57: has joined #RubyOnRails
[13:33:57] arBmind: has joined #RubyOnRails
[13:34:02] matthewd: pusewicz: Are you asking for a way around the above thing not working (which I thought I'd just suggested), or are you asking for a replacement for where_sql that doesn't contain binds?
[13:34:21] tvon: has joined #RubyOnRails
[13:34:25] pusewicz: sorry, that's correct, I'd like a replacement that does not contain bings
[13:34:34] pusewicz: I just tried unprepared_statement block but that does not seem to work either
[13:35:35] matthewd: Okay, yeah, I'm pretty sure we don't have one of those
[13:35:38] matthewd: Why do you want it?
[13:35:55] aruntomar: has joined #RubyOnRails
[13:35:59] pusewicz: We've implemented a Throttled Batch deleter, that implements that query
[13:36:07] pusewicz: now we're trying to upgrade to rails 4.2
[13:36:12] pusewicz: and it breaks unfortunately
[13:36:31] pusewicz: So we execute it like this:
[13:36:32] pusewicz: relation.connection.exec_delete(<<-SQL.strip_heredoc, relation.klass.name, {})
[13:36:32] pusewicz: DELETE FROM #{relation.table_name} #{relation.where_sql} LIMIT #{limit}
[13:36:43] annlewis: has joined #RubyOnRails
[13:37:35] pusewicz: I saw that Arel master implements limit on delete
[13:37:48] pusewicz: but yeah, that's master ;)
[13:38:05] IrishGringo: has joined #RubyOnRails
[13:38:20] matthewd: So why can't you use the `id:` form?
[13:38:36] gremly: has joined #RubyOnRails
[13:38:46] pabvid: has left #RubyOnRails: ()
[13:39:14] pusewicz: because the conditions might be different
[13:39:50] pusewicz: @matthewd we pass in multiple scopes so that we can delete many relationships
[13:40:00] pusewicz: and it iterates over them
[13:41:15] trautwein: has joined #RubyOnRails
[13:41:15] walkingtoast: has joined #RubyOnRails
[13:41:24] gremly: Hi everybody... I'm using Rails 1.9.3 and want to add a model field cleaning before save using after_initialize. It works when I do MyModel.new(field: 'value').. But what about mm = MyModel.new() and mm.field = 'value'?.. May you help me please?
[13:41:52] pusewicz: @gremly just do it in before_save
[13:42:17] Denarii: has joined #RubyOnRails
[13:42:21] matthewd: pusewicz: Okay, `relation.model.where(id: relation.limit(limit)).delete_all`, then?
[13:42:22] pusewicz: or with `def field=(value)` where you do the cleaning
[13:42:29] bmalum: has joined #RubyOnRails
[13:43:17] arup_r: I have HABTM between User and DistributionList. I am trying to use field_for, but it is throwing error: https://gist.github.com/aruprakshit/8b9459517eab821dcf32
[13:43:27] arup_r: How should I use it ? What am I missing
[13:43:51] gremly: pusewicz: Thanks a lot. Is before_save enabled by import method too?
[13:44:23] pusewicz: @gremly not sure, but I would imagine so
[13:44:43] pusewicz: @matthewd that's almost ok, the where condition might have different columns
[13:44:55] pusewicz: eg sometimes we delete users where company_id = 123
[13:45:06] matthewd: pusewicz: I think you're missing the middle part of what I wrote
[13:45:20] matthewd: .. where it uses `relation`
[13:45:48] renews: has joined #RubyOnRails
[13:46:01] gremly: pusewicz: Thanks
[13:46:11] pusewicz: hmm but wouldn't that code always generate DELETE from models WHERE id = ...
[13:46:42] qejk: has joined #RubyOnRails
[13:47:05] matthewd: pusewicz: Yes; it uses a subquery
[13:47:23] matthewd: So, not identical SQL, but it should behave pretty much identically
[13:48:47] GeorgesLeYeti: has joined #RubyOnRails
[13:49:56] podman: has joined #RubyOnRails
[13:50:04] arup_r: can we use fields_for while using HABTM ?
[13:50:16] darrencauthon: has joined #RubyOnRails
[13:50:29] darrencauthon: has joined #RubyOnRails
[13:51:05] pusewicz: @matthewd thank you! that should work. Any idea when native support for limits in delete will be available in stable?
[13:51:19] GeorgesLeYeti: I'm tring to make a ruby script on windows. But i have an issue for creating a folder.
[13:52:20] jameswork: has joined #RubyOnRails
[13:52:37] sunya7a: has joined #RubyOnRails
[13:53:39] GeorgesLeYeti: https://gist.github.com/GeorgesLeYeti/3132135215c7b417470b
[13:54:17] atomical: is there a log analyzer for rails?
[13:54:39] atomical: our app randomly hangs early in the morning and i need to track down the problem
[13:54:43] atomical: i've checked the error log
[13:54:47] atomical: well, the apache error log
[13:55:08] matthewd: pusewicz: As you mentioned, it's in arel master, so it'll be *there* in rails 5.0.... but I'm not sure whether the actual public API on Relation will ever expose it directly
[13:55:21] ankhers: Is rails 3.2.x still supported?
[13:55:38] matthewd: Ankhers: Only for severe security issues
[13:55:53] ankhers: matthewd: Though so. Thanks!
[13:56:44] ankhers: Is there an ETA for rails 5?
[13:56:55] pusewicz: @matthewd perfect: Mysql2::Error: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
[13:57:00] matthewd: Ankhers: The 4.0 upgrade should be pretty smooth for a "modern" 3.2 app... it's nothing like the 2.3 -> 3.0 pain
[13:57:17] matthewd: pusewicz: Ah. :P
[13:57:37] ankhers: matthewd: I don't really think this would be considered "modern" 3.2 unfortunately.
[13:57:48] pusewicz: I might have to pluck it
[13:58:30] matthewd: Ankhers: By "modern" I mean using the 3.x era .where etc API, rather than the older .find(:all) etc... though even most of that should be handled by deprecated_finders
[13:59:06] ankhers: matthewd: Fair enough. Thanks for the help.
[13:59:15] matthewd: pusewicz: If you want an ugly hack, something like relation.limit(limit).select('DELETE').to_sql.sub(/^SELECT */, '') might work ??\_(???)_/??
[13:59:34] pusewicz: hmm, interesting
[14:00:36] matthewd: (though presumably not if you have joins involved, for example)
[14:01:20] pusewicz: or I could just take the WHERE portion of it
[14:01:56] matthewd: or you could combine the two techniques, to put all the conditions in a subquery, but mangle the limit into the outer select
[14:02:19] matthewd: The trick with extracting the WHERE is finding the "right" instance of WHERE in a complex query
[14:02:26] pusewicz: that's true
[14:02:33] h7br1x: has joined #RubyOnRails
[14:02:59] crankharder: getting this "StandardError: RailsVersion requires RailsVersion::Config.api_key to be set in this environment." -- after updating to 4.2.4 -- anyone know what the fix is?
[14:03:30] ankhers: pusewicz, matthewd: Sorry for butting into the conversation, but is it possible to just write raw SQL instead of finding out a hack for whatever it is you are trying to accomplish? (Sorry if this is a dumb suggestion, I don not have full context to the issue)
[14:03:31] mary5030: has joined #RubyOnRails
[14:04:05] pusewicz: it is, but the problem is catching the where conditions from a passed in scope
[14:04:15] renanoronfle: has joined #RubyOnRails
[14:04:36] greengriminal: has joined #RubyOnRails
[14:05:21] mary5030: has joined #RubyOnRails
[14:05:25] U7se6: has joined #RubyOnRails
[14:07:02] wpp: has joined #RubyOnRails
[14:07:12] n1ck7: has joined #RubyOnRails
[14:07:41] guidohcosta_: has joined #RubyOnRails
[14:08:54] IFrank00: has joined #RubyOnRails
[14:12:59] jgpawletko: has joined #RubyOnRails
[14:13:23] barttenbrinke: has joined #RubyOnRails
[14:14:24] barttenbrinke: has joined #RubyOnRails
[14:14:57] syzygy_: has joined #RubyOnRails
[14:15:50] ngscheurich: has joined #RubyOnRails
[14:16:46] zpe: has joined #RubyOnRails
[14:16:53] barttenbrinke: So, where can I find the actioncable support channel :)?
[14:19:10] loren321: has joined #RubyOnRails
[14:19:47] capin: Ankhers: http://rails5countdown.com/
[14:19:50] seank_: has joined #RubyOnRails
[14:20:12] ankhers: capin: Thanks.
[14:23:04] MaDErroR123: has joined #RubyOnRails
[14:24:11] chills42: has joined #RubyOnRails
[14:24:41] arup_r: What is the key to print this emoji ??\_(???)_/??, matthewd ? :)
[14:24:53] Avon: has joined #RubyOnRails
[14:25:02] pusewicz: @arup_r Cmd+C + Cmd+V
[14:25:11] arup_r: let me try
[14:25:19] pusewicz: ??\_(???)_/??
[14:25:31] arup_r: ??\_(???)_/??
[14:27:26] vigintas: has joined #RubyOnRails
[14:27:37] arthurthefourth: has joined #RubyOnRails
[14:28:16] Voxxit: has joined #RubyOnRails
[14:28:57] guidohcosta: has joined #RubyOnRails
[14:29:11] baweaver: has joined #RubyOnRails
[14:29:28] beauby: has joined #RubyOnRails
[14:30:41] Linkinus: has joined #RubyOnRails
[14:31:06] achamian: has joined #RubyOnRails
[14:31:53] n1lo: has joined #RubyOnRails
[14:32:53] treehug88: has joined #RubyOnRails
[14:36:18] rubyonrails453: has joined #RubyOnRails
[14:36:38] kies^: has joined #RubyOnRails
[14:36:55] tenderlove: has joined #RubyOnRails
[14:37:27] rubyonrails474: has joined #RubyOnRails
[14:37:35] weihan: has joined #RubyOnRails
[14:37:36] annlewis: has joined #RubyOnRails
[14:38:47] chouhoulis: has joined #RubyOnRails
[14:38:55] rubyonrails727: has joined #RubyOnRails
[14:39:03] barttenbrinke: has left #RubyOnRails: ()
[14:39:15] barttenbrinke: has joined #RubyOnRails
[14:39:38] banister: has joined #RubyOnRails
[14:41:18] weihan: has joined #RubyOnRails
[14:42:21] dopamean_: has joined #RubyOnRails
[14:44:02] achamian: has joined #RubyOnRails
[14:44:08] guidohcosta: has joined #RubyOnRails
[14:44:52] siaW: has joined #RubyOnRails
[14:45:24] ismaelga: has joined #RubyOnRails
[14:46:44] atmosx: has joined #RubyOnRails
[14:46:51] renews: has joined #RubyOnRails
[14:47:28] umgrosscol: has joined #RubyOnRails
[14:48:07] loc22: has joined #RubyOnRails
[14:48:13] krz: has joined #RubyOnRails
[14:48:16] polishdub: has joined #RubyOnRails
[14:49:03] matthewd: For me the key is "spend too much time talking to tenderlove" :P
[14:49:07] i: has joined #RubyOnRails
[14:49:28] MaDErroR123: has joined #RubyOnRails
[14:52:09] m1lt0n: has joined #RubyOnRails
[14:52:19] zpe: has joined #RubyOnRails
[14:52:26] ismaelga: has joined #RubyOnRails
[14:52:44] GriffinHeart: has joined #RubyOnRails
[14:52:58] annlewis: has joined #RubyOnRails
[14:54:25] zpe_: has joined #RubyOnRails
[14:54:42] loc22: Hi guys, I have a quick question. I have the following query Tag.joins(:posts).group("tags.id").order("count_all desc").count
[14:54:48] Lightsword: has joined #RubyOnRails
[14:55:09] loc22: And I want to iterate over that, but is not a activerecord relation but a hash
[14:55:45] nurbson: Hash.each{ |key, value| do_your_stuff }
[14:55:48] nurbson: does this help?
[14:56:47] n1ck7: has joined #RubyOnRails
[14:59:07] loc22: nurbson: But then I have to do something like Tag.find(key) for each iteration
[14:59:25] HoloIRCUser: has joined #RubyOnRails
[15:00:29] nurbson: what does your hash look like?
[15:00:29] nemo_: has joined #RubyOnRails
[15:00:49] nurbson: aren't the Tags stored in 'value' ?
[15:01:13] jhass: loc22: just call .each on the relation?
[15:01:48] paolodoors: has joined #RubyOnRails
[15:01:50] loc22: jhass, but I want to order them by count in the relationship
[15:01:55] loc22: is a HABTM realtion
[15:01:59] loc22: relation*
[15:02:14] jhass: maybe you don't want .count but .select("COUNT(post_id)") or something? (I never remember the correct stuff for these)
[15:02:23] devdazed: has joined #RubyOnRails
[15:02:36] chopin: has joined #RubyOnRails
[15:02:49] loc22: jhass: how does the query should like with .select?
[15:02:56] loc22: should be like*
[15:03:08] jhass: just what I wrote iirc
[15:04:12] aruntomar: has joined #RubyOnRails
[15:04:32] jhass: so your end goal is to have a list of tags ordered by the one with the most tags first, probably to generate a tag cloud?
[15:04:40] jhass: *most posts
[15:05:51] jhass: did you consider using something like? https://github.com/mbleigh/acts-as-taggable-on
[15:05:55] jhass: https://github.com/mbleigh/acts-as-taggable-on#tag-cloud-calculations
[15:06:11] jhass: https://github.com/mbleigh/acts-as-taggable-on#finding-most-or-least-used-tags
[15:06:38] blackmesa: has joined #RubyOnRails
[15:07:00] wldcordeiro: has joined #RubyOnRails
[15:07:36] tenderlove: has joined #RubyOnRails
[15:08:29] loc22: jhass: Yes, something like that :)
[15:09:17] loc22: jhass: I want to list the top 10 tags
[15:09:50] loc22: jhass: The links are very intresting. But I will want anyways to learn how to do that query
[15:12:55] matthewd: loc22: Tag.joins(:posts).group("tags.id").select("tags.*, COUNT(*) AS post_count").order("post_count DESC").limit(10)
[15:13:56] stannard: has joined #RubyOnRails
[15:15:47] loc22: matthewd: worked like a boss ;) thanks!
[15:16:11] hephaestus_rg: has joined #RubyOnRails
[15:17:05] dideler: has joined #RubyOnRails
[15:17:55] disgrntld: has joined #RubyOnRails
[15:18:39] tenderlove: has joined #RubyOnRails
[15:19:00] chopin: has joined #RubyOnRails
[15:19:27] gasbakid: has joined #RubyOnRails
[15:19:41] relix: has joined #RubyOnRails
[15:20:09] tuelz: has joined #RubyOnRails
[15:20:32] adavia: has joined #RubyOnRails
[15:20:57] tuelz: I'm getting an n+1 warning on `invites.collect(&:tags).flatten.uniq` - I'm guessing this isn't the optimal way to make this query?
[15:21:59] tuelz: (I'm using activerecord)
[15:22:23] tuelz: although that was probably implied by me being in #rubyonrails :p
[15:22:35] tubbo: tuelz: nah, some of us use mongoid too ;)
[15:22:53] rickmasta: has joined #RubyOnRails
[15:24:10] tuelz: is mongoid exclusively for mongodb or can it interface with other similar nosql db's?
[15:25:02] tubbo: tuelz: once you do `collect` it's not really a query anymore, it's iterating over a collection. to do all of that in active_record you'd probably want to do invites.tags.distinct
[15:25:10] hephaestus_rg: has joined #RubyOnRails
[15:25:11] tubbo: which will perform a "SELECT DISTINCT" query on tags
[15:25:38] tubbo: tuelz: mongoid is exclusively for mongodb. a lot of the popular "nosql" databases can be used with rails with their own ORMs, if they have them.
[15:26:13] greengriminal: has joined #RubyOnRails
[15:26:20] h7br1x: has joined #RubyOnRails
[15:27:22] greengriminal: has joined #RubyOnRails
[15:30:18] tuelz: invites is an array of invites, so do I have to loop over each one?
[15:30:38] dopie: has joined #RubyOnRails
[15:31:07] tuelz: invites.tags doesn't work - I'm guessing I need to do some sort of join, but I need advanced sql so little that I always forget it in between brushing up on it ><
[15:31:16] tuelz: 'advanced' heh
[15:31:28] dopie: Has anyone used jQuery file upload before?
[15:31:46] tubbo: tuelz: yeah how did you get `invites`? i assumed that was an ActiveRecord::Relation.
[15:32:05] nurbson: dopie: yes, but it's ages ago.
[15:32:06] tubbo: dopie: !used
[15:32:06] helpa: dopie: Don't ask "does anyone use <thing>?". It's better to just state your problem and if anyone has used <thing> they will most likely answer.
[15:33:16] seank_: has joined #RubyOnRails
[15:33:48] symbol: has joined #RubyOnRails
[15:34:08] tuelz: tubbo: it is an AR::AR_Relation
[15:34:22] tenderlove: has joined #RubyOnRails
[15:34:24] tuelz: it's just a collection of them
[15:36:09] Motoservo: has joined #RubyOnRails
[15:36:12] arBmind: has joined #RubyOnRails
[15:36:47] arup_r: dopie: I used it, and my boss didn't like it, so removed it too :D
[15:37:10] dopie: What did you guys use instead?
[15:37:44] tuelz: I'm seeing answers on SO that suggest the way I'm doing it is the 'correct' way, I guess without writing SQL that'll just be the case?
[15:38:13] roxtrongo: has joined #RubyOnRails
[15:38:58] ivanskie: has joined #RubyOnRails
[15:39:45] matthewd: tuelz: If `invites` is coming from an association, you could create a through association next to it
[15:40:23] tubbo: dopie: i've been loving refile, it's by the same guy who made carrierwave but is a little less intrusive and has direct-to-S3 uploading baked in (sorta, requires an additional gem but it's very easy)
[15:40:40] tubbo: and it comes with JS that let you upload stuff asynchronously.
[15:41:06] dopie: tubbo, does it come with a progress bar?
[15:41:13] tubbo: dopie: but i've also used jQuery File Upload for a lot of things and it's fine.
[15:41:38] tubbo: tuelz: sorry i had to restart my machine, how is `invites` being created?
[15:42:52] matthewd: I really wish we had a way to do a through-association-like operation on an arbitrary relation :|
[15:43:49] matthewd: If anyone's looking for something to contribute ^^ (though coming up with a suitable API will be the hard-but-boring part)
[15:44:06] moeabdol: has joined #RubyOnRails
[15:44:39] tubbo: matthewd: how would you do it in sql?
[15:45:02] renews: has joined #RubyOnRails
[15:45:09] tuelz: tubbo: sorry, looking into it now - app uses some patterns I haven't had much experience with so takes me some time tracking down stuff
[15:46:07] tubbo: tuelz: hopefully it starts as a relation at some point, the point here is you want to attach these constraints to the *query*, not the data coming back.
[15:46:24] tubbo: if you have an Array and not an AR::Relation, then you probably have data and not a SQL query...in other words the query has already been run
[15:46:47] tenderlove: has joined #RubyOnRails
[15:46:55] tuelz: tubbo: okay, so self is an organization and invites is a has_many relation on it
[15:47:44] tubbo: tuelz: then what i gave you should work.
[15:48:41] tuelz: ahh, the problem I think is tags isn't a has_many on invites
[15:48:58] tuelz: that probably matters :p
[15:49:25] tuelz: invites has tags through taggings
[15:52:26] tubbo: tuelz: has_many :tags, through: :taggings is still a has_many.
[15:52:30] tubbo: invites.tags should work
[15:53:26] tuelz: but it doesn't :shrug:
[15:53:35] tuelz: invite.first.tags works
[15:53:40] artto: has joined #RubyOnRails
[15:53:43] tuelz: invites.tags != works
[15:53:46] matthewd: tubbo: invites.tags sounds like exactly the thing I'm claiming we should support but don't
[15:53:56] tubbo: oh, maybe you need a join
[15:54:05] tubbo: tuelz: like invites.includes(:tags)
[15:54:28] unreal_: has joined #RubyOnRails
[15:54:33] matthewd: `class User; has_many :invites; has_many :invite_tags, through: :invites, source: :tags`
[15:55:07] tuelz: invites.includes(:tags).tags?
[15:55:16] tubbo: give it a shot
[15:55:17] SteenJobs: has joined #RubyOnRails
[15:55:19] tubbo: i have no idea though :D
[15:55:31] tuelz: nope, no method error for 'tags')
[15:55:35] tuelz: playing with it htough, thanks
[15:55:55] tubbo: tuelz: either way if you really want that to move faster it should be getting all its data from SQL. you might have to write some SQL to do it yourself.
[15:56:07] matthewd: ^^ allows user.invite_tags, which returns a flattened relation... but there's no way to construct it on the fly
[15:56:35] tubbo: matthewd: so invites.tags kinda sounds like what you were looking for :D
[15:56:44] tubbo: matthewd: there's your API, submit a PR ya lazy bum
[15:57:38] tuelz: `invites.includes(:tags).collect(&:tags).flatten.uniq` gets rid of the n+1 warning at least
[15:57:39] matthewd: heh.. I think we'd need an explicit method of some sort, so we're not fighting with enumerable API
[15:57:42] CodyStringham: has joined #RubyOnRails
[15:57:57] aruntomar: has joined #RubyOnRails
[15:58:05] tuelz: all I did was add the `.includes(:tags)
[15:58:22] matthewd: tuelz: Is invites coming from an association?
[15:58:26] tuelz: matthewd: yes
[15:58:37] tubbo: tuelz: nice
[15:58:40] tuelz: self.invites where self is an organization
[15:58:52] matthewd: So you should be able to define a through-relationship as I did above
[15:58:55] tuelz: didn't really fix the problem, but it got rid of a warning
[15:59:29] tubbo: tuelz: you mean it's still doing an N+1 query and the time it took to get the data back is the same?
[15:59:30] tuelz: matthewd: yeah, that's probably the best practice
[15:59:38] Jasaka: has joined #RubyOnRails
[15:59:40] matthewd: (though arguably that did fix the problem... you're pulling back more data than you need, but it is now only running one query.)
[16:00:04] tuelz: tubbo: no I think it's all this weird JS crap they are doing that's freezing my browser - I just hoped speeding up the backend response would fix it magically
[16:00:06] Pavster: has joined #RubyOnRails
[16:00:40] bmalum: has joined #RubyOnRails
[16:00:49] tuelz: the reason I hoped that is when it's asking for less data on the backend it doesn't freeze
[16:00:56] tubbo: tuelz: you need to learn a thing or two about performance tuning :) first of all..."hope" is not a word that should not be in your vocabulary, for the most part.
[16:01:23] tubbo: getting your rails app to perform better is done by looking at metrics from e.g. new_relic and other sources and figuring out where the pain points lie
[16:01:36] tuelz: tubbo: contract work on legacy software - my goal is to ship it, they don't have the budget to fix it atm ;)
[16:01:38] tubbo: in other words, you need to measure how much time it takes for each piece of the rails app to fulfill a given request
[16:01:57] artto: has joined #RubyOnRails
[16:02:05] hnanon: has joined #RubyOnRails
[16:02:23] arup_r: How can I add values to the button_to params before Ajax call? https://gist.github.com/aruprakshit/be12f915ce8f387ad3e7
[16:03:03] arup_r: I can do it using normal Jquery Ajax. Need to know if the same can be done using button_to remote: true
[16:03:17] tubbo: tuelz: regardless, you performance-tune by taking data/measurements from the app and optimizing the points that are the least efficient.
[16:04:07] achamian: has joined #RubyOnRails
[16:04:17] tuelz: yeah, I'm not sure this is a performance thing now, though. You fixed my immediate problem, though, so thanks
[16:04:31] tuelz: also matthewd +1
[16:04:48] tubbo: hehe, doesn't sound like it...well, the JS performance is part of it but it's not your app at least.
[16:04:52] krz: has joined #RubyOnRails
[16:05:12] tuelz: in an ideal world clients would trust me enough to refactor all the things and perf test
[16:05:31] Uo9er_: has joined #RubyOnRails
[16:05:53] tuelz: or maybe that isn't ideal since I'm probably terrible at writting code
[16:05:57] tubbo: tuelz: are you a freelancer or is someone else estimating these jobs for you?
[16:06:24] tuelz: I'm on a contract where they make the tasks I churn out code
[16:06:35] hephaestus_rg: has joined #RubyOnRails
[16:06:44] orolo: has joined #RubyOnRails
[16:07:39] qejk: has joined #RubyOnRails
[16:08:37] tuelz: I actually have no idea what's going on...all requests return 200, but the front end app just freezes with no errors in the console. Any tips on where to start?
[16:08:40] sinkensabe: has joined #RubyOnRails
[16:09:13] tuelz: I feel like I'm not feeding the frontend much data at all - so I assume a memory leak somewhere, does that sound reasonable?
[16:12:05] arup_r: any chance ?
[16:13:05] pawnbox: has joined #RubyOnRails
[16:13:32] mordocai: has joined #RubyOnRails
[16:14:47] ruurd: has joined #RubyOnRails
[16:16:10] tenderlove: has joined #RubyOnRails
[16:18:13] sinkensabe: has joined #RubyOnRails
[16:18:14] mordocai: So I had a 500 error in production due to devise but I can't quite figure out why. Backtrace here: https://www.refheap.com/110809 error is "NoMethodError: undefined method 'ago' for nil:NilClass". Obviously the core issue is that self.confirm_within was nil, but we have confirm_within set in our config. Is this a devise bug or something we are doing wrong? Can't show code due to being proprietary, but we aren't really doing anything
[16:18:15] mordocai: special with devise. I also notice that most other places in that code are checking for confirm_within being truthy before using it.
[16:19:34] mordocai: Wanted to ask here before filing a bug in case it is something stupid we are doing.
[16:19:35] blackmesa: has joined #RubyOnRails
[16:20:10] CanTonic: has joined #RubyOnRails
[16:20:14] yogeshrt: has joined #RubyOnRails
[16:20:27] tubbo: mordocai: what's config.confirm_again set to?
[16:22:58] gthank: has joined #RubyOnRails
[16:23:13] baweaver: has joined #RubyOnRails
[16:23:47] gthank: Am I missing something? Is there a simple way to get app-level logging into the log generated by logstasher?
[16:24:17] gthank: logstasher being https://github.com/shadabahmed/logstasher
[16:24:50] lindii_: has joined #RubyOnRails
[16:25:19] tubbo: gthank: isn't that what logstasher does?
[16:25:47] gthank: It is doing the rails logging like GET /foo quite nicely
[16:26:00] gthank: But it't totally ignoring things like my calls to logger.error
[16:26:01] tubbo: gthank: glad i could help ;)
[16:26:02] armyriad2: has joined #RubyOnRails
[16:26:06] tubbo: oh that's weird
[16:26:12] gthank: So that's not standard?
[16:26:22] Motoservo_: has joined #RubyOnRails
[16:26:24] armyriad2: has joined #RubyOnRails
[16:26:33] gthank: This is a **SERIOUSLY** legacy codebase, so maybe there's just some fun new thing I need to learn
[16:26:49] chouhoul_: has joined #RubyOnRails
[16:26:51] mordocai: tubbo: And... i'm dumb. Yay for asking for help. We are doing something special with an "AuthenticationPolicy" so we aren't doing things the normal devise way. Sigh. Yeah, so that value is correctly nil. Not sure if that counts as a bug though.
[16:27:06] tubbo: mordocai: no, it doesn't.
[16:27:23] towski_: has joined #RubyOnRails
[16:27:26] tubbo: gthank: i'm not sure honestly, looking at logstasher's README i can't see a very obvious "HERE IS HOW YOU WRITE CUSTOM LOG MSGS"
[16:27:48] tenderlove: has joined #RubyOnRails
[16:28:04] Grundell: has joined #RubyOnRails
[16:28:24] tubbo: but i've never used logstash before either
[16:29:08] riotjones: has joined #RubyOnRails
[16:29:31] yogeshrt: has joined #RubyOnRails
[16:30:03] Maletor: has joined #RubyOnRails
[16:30:03] DEA7TH: has joined #RubyOnRails
[16:30:18] kallisti5: has joined #RubyOnRails
[16:30:21] darrik: has joined #RubyOnRails
[16:30:22] yie: has joined #RubyOnRails
[16:30:42] IFrank00: has joined #RubyOnRails
[16:30:47] borkdude: has joined #RubyOnRails
[16:30:48] guidohcosta: has joined #RubyOnRails
[16:30:49] crankharder: has joined #RubyOnRails
[16:30:54] hive-mind: has joined #RubyOnRails
[16:30:58] kanzure: has joined #RubyOnRails
[16:31:00] ernesto_jimenez: has joined #RubyOnRails
[16:31:00] Mession: has joined #RubyOnRails
[16:31:28] armyriad: has joined #RubyOnRails
[16:31:41] tuelz: has joined #RubyOnRails
[16:33:02] nettoweb: has joined #RubyOnRails
[16:33:57] riotjones: has joined #RubyOnRails
[16:33:59] svkurowsl: has joined #RubyOnRails
[16:34:03] seank_: has joined #RubyOnRails
[16:34:04] chridal: has joined #RubyOnRails
[16:34:25] ekem: has joined #RubyOnRails
[16:35:15] naftilos76: has joined #RubyOnRails
[16:35:43] tenderlove: has joined #RubyOnRails
[16:36:26] matthewd: gthank: At a glance, it looks as though something like `Rails.logger = LogStasher` might work, maybe?
[16:37:05] _djbkd: has joined #RubyOnRails
[16:37:22] pavelz: has joined #RubyOnRails
[16:38:14] h7br1x: has joined #RubyOnRails
[16:38:43] krz: has joined #RubyOnRails
[16:39:01] cfloare: has joined #RubyOnRails
[16:39:43] Sou|cutter: Going by the railtie, I would set config.logstasher.enabled = true
[16:39:45] Sou|cutter: https://github.com/shadabahmed/logstasher/blob/master/lib/logstasher/railtie.rb
[16:40:05] arup_r: When you are using Rails link_to, can we add value to the Jquery Ajax `data:` key while clicking on the link
[16:40:06] Sou|cutter: Logstasher.setup(app) does a handful of things besides just setting Rails.logger
[16:40:45] polishdub: has joined #RubyOnRails
[16:41:26] hightower4: has joined #RubyOnRails
[16:42:45] ismaelga: has joined #RubyOnRails
[16:42:56] armyriad: has joined #RubyOnRails
[16:43:14] towler: has joined #RubyOnRails
[16:43:27] Spami: has joined #RubyOnRails
[16:43:57] GJdan: has joined #RubyOnRails
[16:46:07] cajone: has joined #RubyOnRails
[16:46:31] tenderlove: has joined #RubyOnRails
[16:47:52] aruntomar: has joined #RubyOnRails
[16:48:35] ericjphillips: has joined #RubyOnRails
[16:49:31] dmarr: I've built a module similar to the httparty aaws example, and was wondering how I could use webmock/rspeck to mock out the response for it.
[16:50:14] sinkensabe: has joined #RubyOnRails
[16:50:17] big|bad|wolf: has joined #RubyOnRails
[16:50:20] dmarr: i followed the sinatra solution here https://robots.thoughtbot.com/how-to-stub-external-services-in-tests but my spec still seems to use a real net connection
[16:50:33] petricore: has joined #RubyOnRails
[16:52:49] dmarr: here's a gist https://gist.github.com/marr/41caf258d88997214cc0
[16:55:07] achamian: has joined #RubyOnRails
[16:56:16] chills42: has joined #RubyOnRails
[16:56:57] hephaestus_rg: has joined #RubyOnRails
[16:56:57] vigintas: has joined #RubyOnRails
[16:57:17] siddart: has joined #RubyOnRails
[16:57:33] bobbobbins: has joined #RubyOnRails
[16:58:17] vigintas1: has joined #RubyOnRails
[16:58:47] renews: has joined #RubyOnRails
[17:00:00] tenderlove: has joined #RubyOnRails
[17:00:33] bruno-: has joined #RubyOnRails
[17:06:28] EminenceHC: has joined #RubyOnRails
[17:09:10] Lytol: has joined #RubyOnRails
[17:10:46] basiles: has joined #RubyOnRails
[17:11:36] EminenceHC: has joined #RubyOnRails
[17:12:19] tenderlove: has joined #RubyOnRails
[17:12:26] nemo_: has joined #RubyOnRails
[17:12:57] cnk: has joined #RubyOnRails
[17:14:04] woods: has joined #RubyOnRails
[17:14:10] woods: good morning
[17:14:19] arup_r: yes, woods good mrng
[17:15:13] renegadeandy: Hi all. Can somebody please help me with my custom validation???it seems i cannot access my association : https://gist.github.com/renegadeandy/7039eb1e5692b6376739
[17:15:39] mustmodify: has joined #RubyOnRails
[17:16:29] mustmodify: are there any known issues where Rails will refuse to respond or die when there is an exception? Possibly related: development.log shows that there was a 500 but no stack trace.
[17:17:38] gaurav_wagh: has joined #RubyOnRails
[17:20:03] big|bad|wolf: has joined #RubyOnRails
[17:20:39] chouhoulis: has joined #RubyOnRails
[17:21:31] crystal77: has joined #RubyOnRails
[17:23:39] roxtrongo: has joined #RubyOnRails
[17:23:44] agdr: has joined #RubyOnRails
[17:23:51] tenderlove: has joined #RubyOnRails
[17:24:14] glundgren: has joined #RubyOnRails
[17:24:33] mary5030: has joined #RubyOnRails
[17:24:49] annlewis: has joined #RubyOnRails
[17:26:55] kalusn: has joined #RubyOnRails
[17:28:04] aruntomar_: has joined #RubyOnRails
[17:28:54] gthank: matthewd: Thanks. I'll look into that now
[17:29:21] safety_cut: has joined #RubyOnRails
[17:29:34] gthank: tubbo: Thanks for looking at it. Good to know I'm not going insane
[17:30:15] benhuda: has joined #RubyOnRails
[17:31:22] jaequery: has joined #RubyOnRails
[17:31:30] rakm: has joined #RubyOnRails
[17:32:37] n008f4g_: has joined #RubyOnRails
[17:33:26] jaequery: has joined #RubyOnRails
[17:33:28] arup_r: has joined #RubyOnRails
[17:34:14] cookiez: has joined #RubyOnRails
[17:34:53] seank_: has joined #RubyOnRails
[17:35:07] PlasmaStar: has joined #RubyOnRails
[17:41:15] cball: has joined #RubyOnRails
[17:41:17] dmarr: anyone ? need assist mocking out http request through a module. i did read that someone only had luck doing it when making direct calls from their spec using Net::HTTP but i'd like to create an abstraction and mock that
[17:43:37] EminenceHC: has joined #RubyOnRails
[17:43:44] gthank: Sou|cutter It looks like maybe I'm just using the wrong project https://github.com/shadabahmed/logstasher/issues/25
[17:43:52] jtb__: has joined #RubyOnRails
[17:44:43] tuelz: has joined #RubyOnRails
[17:45:20] gasbakid_: has joined #RubyOnRails
[17:49:06] jenrzzz: has joined #RubyOnRails
[17:49:13] CanTonic: has joined #RubyOnRails
[17:49:40] snockerton: has joined #RubyOnRails
[17:50:28] gabeodess: has joined #RubyOnRails
[17:51:14] gabeodess: can someone help me with ActiveAdmin? I???m trying to add a form to my show page, but only the ???f.actions??? line is being rendered. https://gist.github.com/gabeodess/bd9aa8ddae104f82357b#file-user-rb-L121
[17:52:35] gabeodess: basically, whatever the last line in the semantic_form_for block is what gets rendered and everything else is ignored.
[17:53:14] gabeodess: I know this is how Arbre works (the block is only returning the last line), but I???m wondering how to get around this so I can still use ActiveAdmin::FormBuilder
[17:53:17] basiles: has joined #RubyOnRails
[17:53:17] solars: has joined #RubyOnRails
[17:53:18] hephaestus_rg: has joined #RubyOnRails
[17:53:52] basiles: has joined #RubyOnRails
[17:54:20] arup_r: has joined #RubyOnRails
[17:55:18] manfrin: has joined #RubyOnRails
[17:55:20] bruno-: has joined #RubyOnRails
[17:56:06] arup_r: How would you submit params using link_to to sever as Ajax
[17:56:24] hfp_work: has joined #RubyOnRails
[17:56:39] symbole: has joined #RubyOnRails
[17:56:53] achamian: has joined #RubyOnRails
[17:56:54] hfp: has joined #RubyOnRails
[17:57:19] gabeodess: arup_r: append them to the querystring
[17:57:44] arup_r: no. I want to do PUT. Let me think.
[17:58:16] gabeodess: arup_r: create a custom binding and user jQuery.ajax
[17:58:47] mary5030: has joined #RubyOnRails
[17:58:51] arup_r: gabeodess: I am seeing https://github.com/rails/jquery-ujs/blob/c7f15691980bdbf032fbfd15842e39a7873bc65e/src/rails.js#L138 here.. I can pass params, but when hiting the url. not seeing it
[17:58:56] arup_r: may be I am doing it wrong
[17:59:07] arup_r: gabeodess: can you give me an example ?
[17:59:30] renews: has joined #RubyOnRails
[17:59:38] arup_r: If I do link_to 'Remove Selected', remove_users_distribution_list_path(distribution_list), method: :put, remote: true, id: "remove_users", class: "btn btn-alt", data: { params: {id: 2}}
[17:59:41] gabeodess: arup_r: oh, interesting
[17:59:48] arup_r: that params not going there
[17:59:52] troyready: has joined #RubyOnRails
[17:59:52] mary5030: has joined #RubyOnRails
[18:00:09] roxtrongo: has joined #RubyOnRails
[18:00:12] arup_r: I have some other requirement, just playing how can I do send the data to server
[18:00:19] gabeodess: arup_r: yeah, looks like that should work.
[18:00:23] n1ck7: has left #RubyOnRails: ()
[18:00:24] tbuehlmann: pass it as a hash in the path helper
[18:00:37] mary5030: has joined #RubyOnRails
[18:00:42] arup_r: gabeodess: With classic jquery, when we do $.ajax(), we pass data to server using a key `data`
[18:00:51] tbuehlmann: as in `remove_users_distribution_list_path(distribution_list, id: 2)`
[18:00:52] dmarr: the odd thing is in rails console I see "WebMock::NetConnectNotAllowedError: Real HTTP connections are disabled"
[18:00:59] adac: has joined #RubyOnRails
[18:01:03] n1ck7: has joined #RubyOnRails
[18:01:10] arup_r: I am hpoing the same can be done using remote: true
[18:01:19] arup_r: but not able to figure it out
[18:01:22] n1ck7: How exactly does "accepts_nested_attributes_for" work in Rails? For example, if I have a "followed_topic" model which belongs to, and accepts attributes for "topic", how can I get the "followed_topic" model to save the topic data as well?
[18:01:29] dmarr: now i'm trying to make a real request, and have tried commenting out the webmock config which disables requests
[18:01:30] arup_r: tbuehlmann: I don't want to make a query string.
[18:01:41] tbuehlmann: then make it a remote form
[18:01:56] arup_r: No possible in my case. I can't use button_to also
[18:02:03] arup_r: as the dom is already inside a form
[18:02:04] mary5030: has joined #RubyOnRails
[18:02:22] arup_r: so form inside form doesn't make sense and it wouldn
[18:02:37] tbuehlmann: so have an on click event handler?
[18:02:52] _djbkd: has joined #RubyOnRails
[18:03:34] arup_r: Yes, I can do it using vanilla Jquery $.ajax() . Pretty easy. But I want to do it using link_to remote: true way if possible
[18:05:22] arup_r: tbuehlmann: jquery-ujs source showing it is possible. But not able to figure out the correct way
[18:05:28] arup_r: I am still trying
[18:05:37] gusrub: has joined #RubyOnRails
[18:05:51] doritostains: has joined #RubyOnRails
[18:06:28] arup_r: possible gabeodess
[18:06:42] chouhoulis: has joined #RubyOnRails
[18:07:27] U7se6: has joined #RubyOnRails
[18:07:32] davispuh: has joined #RubyOnRails
[18:08:03] arup_r: well, now I will do something else. lets see.. I want to add it inside the https://gist.github.com/aruprakshit/be12f915ce8f387ad3e7#file-button-coffee-L1
[18:08:09] tbuehlmann: arup_r, what about having the form outside your form and submit it by clicking that link?
[18:08:09] arup_r: let me try now
[18:08:29] arup_r: still check my half dom.
[18:08:39] arup_r: dom is somewhat not letting me do it
[18:09:05] ModusPwnens: has joined #RubyOnRails
[18:09:12] arup_r: that button_to in my gist is actually now link_to
[18:09:19] tubbo: arup_r: i typically have to use link_to in order to do something like that
[18:09:24] arup_r: button_to submitting the form.. so can't use it
[18:09:25] tubbo: button_to tries to submit th eform
[18:09:26] tubbo: the form*
[18:09:32] MaDErroR123: has joined #RubyOnRails
[18:09:34] ModusPwnens: When people add roles to their User objects, do they normally use an enum to contain possible values or do they just have conditional checks on symbols everywhere for access controls?
[18:09:39] arup_r: old gist.. let me update
[18:09:51] arup_r: ModusPwnens: enum is sexy way to do it
[18:10:18] arup_r: you will get lot of useful helpers if you use enum
[18:10:27] tubbo: @ModusPwnens i use pundit and policies to achieve this, and use a custom decent_exposure strategy to implicitly authorize any collection or model that's created.
[18:11:00] tubbo: arup_r: i thought enum was used for when you have a single field, like a 'status', that needs to move through a list of states in a given order
[18:11:01] netzfisch: has joined #RubyOnRails
[18:11:09] ModusPwnens_: has joined #RubyOnRails
[18:11:12] arup_r: tubbo: You know how to crack jquery-ijs very well. I got inspire by you.. so.
[18:11:19] tubbo: oh never mind i was wrong
[18:11:27] tubbo: but yeah, Enum is a really bad choice for user roles imho http://api.rubyonrails.org/v4.1.0/classes/ActiveRecord/Enum.html
[18:11:39] tubbo: you can't set like "admin > moderator > user", etc.
[18:11:46] tubbo: there's nothing in enum that helps you with that
[18:11:52] tbuehlmann: I think it's okay as long as you don't need multiple roles per user
[18:12:33] ModusPwnens: has joined #RubyOnRails
[18:12:35] tubbo: tbuehlmann: right but it's not like, "the right way" of doing it...which is what arup_r was implying. you can totally use enum for roles but it's going to break down in that case and therefore it can't possibly be the right way to do it.
[18:12:49] ModusPwnens: Sorry about that. I DCed and didn't get any of the past conversation regarding enums and user roles.
[18:12:54] tbuehlmann: don't see the problem yet, can you elaborate?
[18:13:05] ynonp: has joined #RubyOnRails
[18:13:21] ModusPwnens: For the record, my users aren't being persisted. I'm just using LDAP and POSIX groups to determine access level.
[18:13:25] arup_r: neither me
[18:13:40] tubbo: ModusPwnens: ah, well then nothing in ActiveRecord is going to help you :)
[18:13:56] EminenceHC: has joined #RubyOnRails
[18:14:06] ModusPwnens: tubbo: Is there a general 'ruby' strategy I would use for this? Or do I just have checks like @current_user.role == :admin
[18:14:11] arup_r: pusewicz: for me Cmd+c and Cmd+v wouldn't work. I am not on mac :(
[18:14:25] tubbo: the issue with storing roles as a big enum is the inability to store multiple roles, but then again in that case it would be more like a 'user group' and less like a role, so i might be mistaken here
[18:14:36] tubbo: arup_r: s/Cmd/Ctrl
[18:14:39] gabeodess: arup_r: just did a test on my end and it seems to work as expected.
[18:14:40] ModusPwnens: tubbo: I only worry about that because that means if I ever change the admin role or delete it or something, I have checks peppered everywhere using symbols that don't actually exist.
[18:14:44] tbuehlmann: ModusPwnens, tubbo suggested the pundit library (which I also like) for authorization
[18:15:09] tubbo: ModusPwnens: right, it would be easier if there was only one place that controlled authorization for your entire app
[18:15:36] ModusPwnens: tbuehlmann: What do you think about this? https://github.com/matiasgagliano/action_access
[18:15:55] hfp_work: has joined #RubyOnRails
[18:16:19] arup_r: tubbo: Ctrl is not working. Because it is pasting what I have in my clipboard.
[18:16:25] hfp: has joined #RubyOnRails
[18:16:27] arup_r: gabeodess: albeit it works. :D
[18:16:31] FailBit: pundit looks odd
[18:16:32] K_r3aPeR: has joined #RubyOnRails
[18:16:32] Grundell: has joined #RubyOnRails
[18:16:36] arup_r: I confirmed you already
[18:16:36] FailBit: string manipulation
[18:16:41] FailBit: constantize
[18:16:43] FailBit: seems hacky
[18:16:46] tbuehlmann: never seen that, but the fact that the model is directly involved wonders me
[18:17:11] EminenceHC: has joined #RubyOnRails
[18:17:22] arup_r: gabeodess: Undocumented well implemented feature.
[18:17:26] tubbo: arup_r: you're not very good with computers are you
[18:17:43] tubbo: sorry i'm usually pretty nice but i'm definitely making fun of you if you don't know how ctrl+v works ;)
[18:17:43] arup_r: no I am not :/
[18:17:50] FailBit: what happens if you call authorize with a nil object?
[18:18:01] FailBit: does it look for a NilClassPolicy?
[18:18:21] arup_r: see if I do Ctrl+c CTRL+v .. you will get :
[18:18:23] arup_r: https://gist.github.com/aruprakshit/be12f915ce8f387ad3e7#file-button-coffee-L1
[18:18:31] arup_r: not the emoji I want
[18:18:36] ModusPwnens: tubbo: Is it bad ruby practice to just have checks on raw symbols from another class?
[18:18:43] tubbo: arup_r: ahh that happens to me too, it has something to do with the encoding
[18:18:44] FailBit: ModusPwnens: ?
[18:18:48] tubbo: ModusPwnens: too vague
[18:18:57] tbuehlmann: I like pundit as the implementation is very simple, just POROs. it encapsulates the auth logic from the model
[18:19:05] tubbo: FailBit: lol you know how rails works right? :P that's pretty much the basis behind it
[18:19:18] ModusPwnens: E.g., @current_user.role == :some_symbol, where the symbol is assigned to role elsewhere
[18:19:35] matthewd: tubbo: I have to be good with Ctrl-C Ctrl-V... how else could I do any programming?!
[18:19:45] tbuehlmann: ModusPwnens, you'd have to change quite a lot of code when the symbol changes, right?
[18:19:54] ModusPwnens: tbuehlmann: Yes, hence my concern.
[18:20:01] tubbo: FailBit: perhaps i am mistaken. how do YOU think it works?
[18:20:02] riotjones: has joined #RubyOnRails
[18:20:18] tbuehlmann: that's why I wouldn't spread that code all over your controllers and views. an abstraction might be something
[18:20:33] tbuehlmann: as in, pundit maybe? :>
[18:21:01] FailBit: tubbo: I think it calls "#{obj.class.to_s}Policy".constantize
[18:21:08] FailBit: because that's how rails works right
[18:21:41] tubbo: FailBit: rails does that too. how do you think it knows to turn `resources :posts` into `PostsController`?
[18:21:44] IrishGringo: has joined #RubyOnRails
[18:22:17] FailBit: "#{rname.camelize.capitalize}Controller"
[18:22:34] hfp_: has joined #RubyOnRails
[18:22:47] tubbo: right. so that's string manipulation and constantize :)
[18:23:03] tubbo: it's just establishing conventions and figuring out where code is based on said convention
[18:23:05] hfp__work: has joined #RubyOnRails
[18:23:39] tubbo: active_support was written to scratch someone's own itch. most definitely.
[18:23:51] FailBit: is the string manipulation run on every call to authorize?
[18:24:04] FailBit: or is it cached in eg a hashtable
[18:24:48] FailBit: I mean for pundit
[18:25:01] nemo_: has joined #RubyOnRails
[18:25:44] kadoppe: has joined #RubyOnRails
[18:25:48] nya: has joined #RubyOnRails
[18:25:50] annlewis: has joined #RubyOnRails
[18:25:58] FailBit: also, pundit is basically java
[18:26:17] tbuehlmann: so much hate
[18:26:25] FailBit: objects and not functions
[18:29:21] yfeldblum: has joined #RubyOnRails
[18:29:35] MaDErroR123: has joined #RubyOnRails
[18:29:56] tubbo: FailBit: lol quit while you're ahead :P
[18:31:45] baweaver: has joined #RubyOnRails
[18:32:19] Avon: has joined #RubyOnRails
[18:32:42] naftilos76: has joined #RubyOnRails
[18:35:06] craysiii: has joined #RubyOnRails
[18:35:15] loc22: has joined #RubyOnRails
[18:35:46] seank_: has joined #RubyOnRails
[18:36:20] rubyonrailed: has joined #RubyOnRails
[18:38:31] nickenchuggets: has joined #RubyOnRails
[18:38:31] nickenchuggets: has joined #RubyOnRails
[18:39:57] tercenya: has joined #RubyOnRails
[18:41:27] mustmodify: has left #RubyOnRails: ()
[18:42:03] blackmesa: has joined #RubyOnRails
[18:42:38] avemestr: has joined #RubyOnRails
[18:44:37] arup_r: tbuehlmann: I am done :) https://gist.github.com/aruprakshit/be12f915ce8f387ad3e7
[18:44:43] arup_r: feeling happy now
[18:46:49] Sheperson: has joined #RubyOnRails
[18:47:08] sunya7a: has joined #RubyOnRails
[18:47:27] tbuehlmann: how do people like coffee script? asking for a friend???
[18:48:11] n1ck7: has joined #RubyOnRails
[18:49:13] arup_r: Without coffescript, I wouldn't ever be able to write JS code. :(
[18:49:23] gasbakid_: has joined #RubyOnRails
[18:49:27] craysiii: is it not possible to put plain JS in one of my .coffee files?
[18:49:35] tubbo: craysiii: no it is not.
[18:49:52] ericjphillips: has joined #RubyOnRails
[18:50:29] jlebrech: has joined #RubyOnRails
[18:50:34] craysiii: is there a reason rails wants me to use coffeescript for individual asset scripts but application.js is plain JS?
[18:50:53] craysiii: not trying to complain, want to know if theres an actual reason
[18:51:04] tenderlove: has joined #RubyOnRails
[18:51:42] tubbo: well, most people don't actually put any js code in application.js, it's just a manifest.
[18:52:17] craysiii: interesting..
[18:52:26] arup_r: crankharder: coffeescript is strict syntax lang
[18:52:40] arup_r: mostly indentation
[18:52:54] arup_r: if it goes wrong.. it will start shouting..
[18:52:56] vigintas: has joined #RubyOnRails
[18:53:19] arup_r: HAML and Coffeescript goes hand in hand,
[18:54:09] tubbo: i tried using slim the other day, but i found its lack of syntax highlighting of html tags invented in the past 5 years disturbing.
[18:54:14] eyck: has joined #RubyOnRails
[18:54:35] tubbo: such as <header>, <footer> and <main>
[18:54:47] FailBit: footer= @foo
[18:54:57] FailBit: what's the issue?
[18:55:40] annlewis: has joined #RubyOnRails
[18:55:57] ngscheurich: has joined #RubyOnRails
[18:56:12] nya: has joined #RubyOnRails
[18:56:15] tubbo: FailBit: this is what my code looks like when i use vim-slim. http://imgur.com/paGWxJi
[18:56:45] tenderlove: has joined #RubyOnRails
[18:56:45] h7br1x: has joined #RubyOnRails
[18:56:46] tubbo: FailBit: i hate how i can barely tell the difference between tags in the first place (bold vs. non-bold text is the only indicator) and the fact that it doesn't even highlight newer semantic tags sucks.
[18:56:47] cleopatra: ACTION hello people
[18:56:52] FailBit: vim-slim does not have support for those elements, sure
[18:56:55] FailBit: why not add it
[18:57:15] tubbo: yeah i suppose i probably should
[18:57:27] tubbo: FailBit: do you see that stuff highlighted in your editor?
[18:57:29] FailBit: vim-slim also copies a lot of stuff from haml
[18:57:36] FailBit: I also am not really bothered by it
[18:57:41] FailBit: author, header, etc
[18:57:44] FailBit: doesn't matter to me
[18:58:03] tubbo: well vim-haml has all that highlighted and has for a while
[18:58:10] siaW: has joined #RubyOnRails
[18:58:31] tubbo: i guess the real point is i don't care enough to use slim if it looks bad by default and i don't get much win out of using it.
[18:58:48] FailBit: you should at least use hamlit, then
[18:58:58] FailBit: it has a fixed attribute parsers and uses temple as the underlying compiler
[18:59:13] elventails: has left #RubyOnRails: ()
[18:59:26] FailBit: https://github.com/k0kubun/hamlit
[18:59:40] choke: has joined #RubyOnRails
[18:59:46] nfk: has joined #RubyOnRails
[18:59:58] tubbo: FailBit: that's pretty cool, i'll check it out. though the view code has almost never been where i need to optimize.
[19:00:35] FailBit: switching to slim from haml caused quite a performance gain for us
[19:01:03] FailBit: that dropped us from 120ms to 105ms avg
[19:01:06] tubbo: yeah, and you were saying that you spent a lot of time in the view code/markup for a few different reasons
[19:01:22] FailBit: and then I cut that to 93ms after a fix to broken memoization
[19:01:34] tubbo: seems like using hamlit is just as good as using slim though
[19:02:17] ankhers: FailBit: Sorry for butting in, but is that 93ms server, or 93ms round trip?
[19:02:20] _djbkd: has joined #RubyOnRails
[19:02:37] jlebrech: has joined #RubyOnRails
[19:03:10] FailBit: roundtrip is pretty wildly varying because server is in france and 50% of userbase is in US
[19:03:31] FailBit: I think most end-user load times are around 1.5-3s
[19:03:51] ankhers: I figured. Thanks.
[19:04:12] FailBit: site is TLS-enabled so that adds on a bit
[19:04:26] tuelz: has joined #RubyOnRails
[19:04:38] FailBit: actually, it's behind cloudflare, so it doesn't add on as much as it used to especially for mobile devices
[19:04:48] FailBit: because chacha20/poly1305-based enc
[19:04:56] dikaio: has joined #RubyOnRails
[19:05:18] gabeodess: has joined #RubyOnRails
[19:05:42] jenrzzz: has joined #RubyOnRails
[19:05:48] mustmodify: has joined #RubyOnRails
[19:05:57] crystal77: has joined #RubyOnRails
[19:07:38] Grundell: has joined #RubyOnRails
[19:08:35] momomomomo: has joined #RubyOnRails
[19:08:39] platzhirsch: has left #RubyOnRails: ()
[19:09:03] Ergo: has joined #RubyOnRails
[19:09:06] ngscheur1: has joined #RubyOnRails
[19:09:36] tenderlove: has joined #RubyOnRails
[19:11:08] kallisti5: is this too gross?
[19:11:09] kallisti5: @sbms = @sbms.page(params[:page]) if params[:format].nil?
[19:11:16] kallisti5: (in controller)
[19:11:32] kallisti5: (trying to not paginate json)
[19:11:41] kallisti5: it works... but makes me feel a bit dirty
[19:11:49] kallisti5: (and no page!)
[19:12:05] jhass: might be clearer to check for != "json"
[19:12:21] siddart: has joined #RubyOnRails
[19:12:35] mshiltonj: has joined #RubyOnRails
[19:13:27] Scient: you should probably separate the action paths based on the format instead of resorting to dirty checks
[19:13:42] MaDErroR123: has joined #RubyOnRails
[19:15:13] jessemcgilallen: has joined #RubyOnRails
[19:15:50] ynonp: has joined #RubyOnRails
[19:17:29] Cache_Money: has joined #RubyOnRails
[19:18:19] jenrzzz: has joined #RubyOnRails
[19:18:53] monq: has joined #RubyOnRails
[19:19:18] rhizome: put it in the/a respond_to block
[19:19:22] sunya7a: has joined #RubyOnRails
[19:19:37] chills42: has joined #RubyOnRails
[19:22:25] kinduff: has joined #RubyOnRails
[19:22:30] renegadeandy: has joined #RubyOnRails
[19:22:31] netzfisch: has joined #RubyOnRails
[19:22:34] momomomomo: has joined #RubyOnRails
[19:23:52] tenderlove: has joined #RubyOnRails
[19:24:30] nya: has joined #RubyOnRails
[19:25:24] nogic: has joined #RubyOnRails
[19:25:41] Cervajz__: has joined #RubyOnRails
[19:26:12] Daquan: has joined #RubyOnRails
[19:27:19] sunya7a: has joined #RubyOnRails
[19:28:20] chandlerbing: has joined #RubyOnRails
[19:29:51] Grundell_: has joined #RubyOnRails
[19:32:26] tenderlove: has joined #RubyOnRails
[19:33:13] DoubleMalt: has joined #RubyOnRails
[19:33:18] ruurd: has joined #RubyOnRails
[19:33:48] workmad3: has joined #RubyOnRails
[19:34:21] polishdub: has joined #RubyOnRails
[19:34:54] sinkensabe: has joined #RubyOnRails
[19:36:41] seank_: has joined #RubyOnRails
[19:37:25] _el_fer_: has joined #RubyOnRails
[19:38:08] tenderlove: has joined #RubyOnRails
[19:40:13] chouhoulis: has joined #RubyOnRails
[19:42:01] Radar: good morning
[19:42:14] capin: afternoon
[19:42:51] shmilan: has joined #RubyOnRails
[19:43:50] gasbakid_: has joined #RubyOnRails
[19:44:31] rickmasta: has joined #RubyOnRails
[19:45:18] choke: has joined #RubyOnRails
[19:45:51] SteenJobs_: has joined #RubyOnRails
[19:47:48] EminenceHC: has joined #RubyOnRails
[19:48:19] gasbakid: has joined #RubyOnRails
[19:48:21] rubyonrailed: I have this line to start a loop `- @meetings.each_slice((@meetings.size/3.to_f).ceil) do |meetings|` but it breaks if there are less than 3 meetings. How can I get around that and still be able to loop through meetings if there are less than 3?
[19:48:39] Radar: rubyonrailed: in_groups_of(3)
[19:51:15] glundgren: i'm stunned by the fact that Radar still didn't made a rule to adopt the defunct internet time to make people in different timezones doesn't feel upset by a good morning when he is at afternoon
[19:51:16] Lytol: has joined #RubyOnRails
[19:51:33] mustmodify: has left #RubyOnRails: ()
[19:51:34] glundgren: Radar: an idea for you
[19:52:41] t4nkD: has joined #RubyOnRails
[19:53:01] crystal77: I'm printing @name.pets, which works...but if you have no pets, it's blank. How would I print "No Pets" if .pets returns empty? (sorry, real new to all of this)
[19:53:03] glundgren: or simply ban good mornings and good afternoons in the channel
[19:53:05] gasbakid: has joined #RubyOnRails
[19:53:11] glundgren: it's racist
[19:54:35] woods: I'm sitting at work, lamenting the fact that we are on a LAMP stack, instead of using rails
[19:54:42] t4nkD: Hopefully I'm forgetting something obvious, but, is there an easy way to use a HM:T association where one of the join record keys is NOT an ID? I'm having trouble rewriting query for my inner join...
[19:55:39] t4nkD: Should look like INNER JOIN `fallouts` ON `samples`.`md5`=`fallouts`.`dropped_file_md5` but instead I'm stuck with `samples`.`id`
[19:55:50] havenwood: glundgren: Please observe Universal Greeting Time (UGT): http://www.total-knowledge.com/~ilya/mips/ugt.html
[19:55:52] safety_cut: has joined #RubyOnRails
[19:56:21] sinkensabe: has joined #RubyOnRails
[19:56:27] capin: crystal77: if @name.pets.blank? then put "No Pets"
[19:56:39] glundgren: havenwood: unbelievable :P
[19:57:53] atomical_: has joined #RubyOnRails
[19:59:53] unreal: has joined #RubyOnRails
[20:00:45] MaDErroR123: has joined #RubyOnRails
[20:00:56] boombadaroomba: has joined #RubyOnRails
[20:02:33] gasbakid: has joined #RubyOnRails
[20:02:40] EminenceHC: has joined #RubyOnRails
[20:03:07] woods: I have discovered that when developing in RoR, I have just about as much fun as when developing in C.
[20:03:49] FailBit: so, you have a horrible time?
[20:04:03] woods: incorrect, I actually like C a lot.
[20:04:13] FailBit: C is.. okay
[20:04:21] woods: Some might call me an aspiring embedded developer.
[20:04:25] FailBit: I hate C++ a lot more but that's because I'm just an opinionated bastard
[20:04:42] tbuehlmann: has joined #RubyOnRails
[20:05:23] woods: I've only used C++ in an intro course that I took a few years ago. I didn't mind it too much, but to be fair I don't think I ever got much into the stuff for which people hate it.
[20:05:27] ngscheur1: has joined #RubyOnRails
[20:05:49] renegadeandy: Hi all. Can somebody please help me with my custom validation???it seems i cannot access my association : https://gist.github.com/renegadeandy/7039eb1e5692b6376739
[20:06:48] Jasaka: has joined #RubyOnRails
[20:07:16] blackmesa: has joined #RubyOnRails
[20:08:10] avemestr: renegadeandy: Can we see the rest of day.rb?
[20:08:51] renegadeandy: avemestr: ive updated it :)
[20:08:52] rhizome: (self.schedule.start_date..self.schedule.end_date).includes?(self.wday)
[20:09:49] renegadeandy: rhizome: ok???..! but surely that would result in the same error...
[20:09:53] t4nkD: primary_key, the answer is primary_key...
[20:10:06] rhizome: i would say that there is no schedule for that Day, then
[20:10:32] renegadeandy: well???.at the point this validation occurs???.the schedule won???t have been made???.but is ???in memory???
[20:10:37] renegadeandy: its part of a nested form
[20:10:53] renegadeandy: so its built, but not saved.
[20:11:07] rhizome: well if there's no FK for the association, the validation isn't going to know
[20:11:27] renegadeandy: rhizome: yeah???.but is there anyway for me to access the associated objects state?
[20:11:46] rhizome: it's not associated yet, by my guess
[20:11:51] renegadeandy: There must still be an in memory association???.as rails plans on asking the DB to make an association
[20:11:57] yardenbar: has joined #RubyOnRails
[20:12:16] renegadeandy: rhizome: you are right???but i need to access the schedules state, so what are my options
[20:12:41] rhizome: i haven't thought too much about it, but you may be trying to do too many things at once.
[20:13:14] renegadeandy: rhizome: probably, but im too far down this route to change at this point, either i validate this, or i drop it and give up on that particular edge case.
[20:13:43] n008f4g_: has joined #RubyOnRails
[20:13:49] tenderlove: has joined #RubyOnRails
[20:14:00] rhizome: what would it take to save the schedule first?
[20:14:55] tenderlove: has joined #RubyOnRails
[20:15:34] EminenceHC: has joined #RubyOnRails
[20:15:36] adac: has joined #RubyOnRails
[20:15:41] arup_r: How can I submit the data to Rails as an array? Right now it is going as an string. https://gist.github.com/aruprakshit/7ea89fb779e9a40b9e5c
[20:15:41] renegadeandy: hmmm, im not sure???.its all created as part of an ???event??? objects update call
[20:15:58] thither: If I call destroy() on a model will it destroy all models in a has_many relationship too?
[20:16:24] ngscheurich: has joined #RubyOnRails
[20:16:29] renegadeandy: thither: if you have something like : has_many :days, :dependent => :destroy
[20:16:50] thither: Okay thanks
[20:17:35] arup_r: I am keeping some JS array to the hidden field, but when it is coming to Rails it is not a array, some shit it is there. What is the trick /
[20:18:04] renegadeandy: arup_r: you need to permit it if you are using a object_params method: :id => []
[20:18:30] renegadeandy: arup_r: arrays by default are not permitted in forms in rails
[20:18:42] renegadeandy: rhizome: do i have any way around this?
[20:18:50] arup_r: no. I am asking how can I shape those data as array inside the params hash
[20:19:03] blackmesa: has joined #RubyOnRails
[20:19:05] renegadeandy: maybe on the hash add .to_a
[20:19:09] renegadeandy: for that element?
[20:19:37] arup_r: I want it to come as
[20:19:49] tenderlove: has joined #RubyOnRails
[20:19:57] renegadeandy: arup_r: sorry i cannot really help, as I don???t understand coffeescript!
[20:20:08] arup_r: Parameters: {"utf8"=>"???", "distribution_list"=>{"user_ids"=>[2,2,2], "external_users"=>["lkl@email.com","lkl@email.com","lkl@email.com"],
[20:20:18] h7br1x: has joined #RubyOnRails
[20:20:25] renegadeandy: so you want your emails and userids as arrays
[20:20:26] arup_r: The above params I am expecting to come
[20:20:36] renegadeandy: Is that whwat you are sending?
[20:20:50] relix: has joined #RubyOnRails
[20:20:51] arup_r: something I need to do to give it a shape, but I am not able to remember it
[20:21:02] riotjones: has joined #RubyOnRails
[20:21:06] renegadeandy: is that example exactly what your client side is sending to rails?
[20:21:21] renegadeandy: i think you need to permit arrays on the client side
[20:21:23] renegadeandy: **server side
[20:21:35] arup_r: those data are test. I put all nonsense data in the form and submit to see how it comes
[20:21:40] renegadeandy: post your rails server log and the controller processing this request please arup_r
[20:21:52] arup_r: that log is rails server
[20:21:57] matthewd: glundgren: Sorry, I wasn't paying attention earlier... were you trying to pick another fight?
[20:22:16] glundgren: matthewd: no, i was just kidding
[20:22:42] glundgren: matthewd: is it allowed?
[20:23:09] duderonomy: has joined #RubyOnRails
[20:24:09] jxl180: has joined #RubyOnRails
[20:24:27] jxl180: has left #RubyOnRails: ()
[20:24:32] nya: has joined #RubyOnRails
[20:24:40] glundgren: matthewd: ??? really, tell me, please
[20:25:57] tenderlove: has joined #RubyOnRails
[20:26:29] shinnya: has joined #RubyOnRails
[20:26:30] sunya7a: has joined #RubyOnRails
[20:26:46] matthewd: I don't make the rules... but I would suggest that kidding about someone/thing being racist can be difficult to make obvious, in the context of other, non-kidding, comments one might make
[20:27:12] glundgren: oh my god, UN BE LIE VA BLE...
[20:27:17] tubbo: glundgren: fwiw i got it
[20:27:47] glundgren: i send an email to dhh about this madness
[20:28:05] glundgren: you are breaking the community with these excessive rules
[20:28:33] glundgren: its a freaking IRC channel
[20:28:34] tubbo: i'll break your community
[20:28:35] glundgren: not a church
[20:28:48] tubbo: </internet-tough-guy>
[20:29:10] mwat: has joined #RubyOnRails
[20:29:14] glundgren: im always the one who "picks a fight"
[20:29:22] glundgren: around here, unbelievable
[20:29:36] woods: you are the instigator of the bunch?
[20:29:54] arup_r: renanoronfle: I reached till https://gist.github.com/aruprakshit/7ea89fb779e9a40b9e5c .. I am close enough :D
[20:30:01] arup_r: let me google more.
[20:30:18] glundgren: no, but im kind of tired of this excessive political correctness
[20:30:28] tubbo: i wouldn't say it's excessive.
[20:30:37] glundgren: i will not talk about it over here
[20:30:45] glundgren: Radar loves to ban me
[20:30:57] tubbo: that's good, because we have enough problems to deal with here than having people come in and making up new ones. which is typical programmer shit.
[20:31:13] mwat: has joined #RubyOnRails
[20:31:14] tubbo: programmers love to solve problems, the best problems to solve are the ones you invent all on your own, because you already know how to solve them
[20:31:16] woods: Problem.new
[20:31:19] SteenJobs_: has joined #RubyOnRails
[20:31:29] VeryBewitching: has joined #RubyOnRails
[20:31:47] glundgren: yeah, lets see in a few weeks
[20:31:59] tubbo: i'm sure we will.
[20:32:05] tubbo: VeryBewitching: UGH GOD DAMMIT FOLLOW THE RULES.
[20:32:12] tubbo: VeryBewitching: just kidding :)
[20:32:17] VeryBewitching: ACTION hides.
[20:32:37] tubbo: we were just talking about people coming in and wishing us a good morning/evening/whatever, and i couldn't wait for you to log on :)
[20:32:50] VeryBewitching: At least I didn't use !guys
[20:32:58] rhizome: i feel like glundgren just finished telling the world's worst swatch joke
[20:33:00] bratsche: has joined #RubyOnRails
[20:33:12] woods: which side of the UGT debate is the correct one to fall in?
[20:33:29] tubbo: woods: whichever one was written using Vim.
[20:33:30] glundgren: woods the politically correct side, of course
[20:33:43] woods: i love vim
[20:33:43] mloy: tubbo, I lol'd
[20:33:48] woods: and hate political correctness
[20:33:55] matthewd: glundgren: FWIW, I actually only just joined a few days ago
[20:34:08] arup_r: hey. help me..
[20:34:16] glundgren: matthewd: and.. ?
[20:34:27] nettoweb: has joined #RubyOnRails
[20:34:35] glundgren: let me light a cigarrete, a regular one, not a marijuana
[20:34:46] glundgren: sorry, its not politically correct
[20:34:57] chandlerbing: has joined #RubyOnRails
[20:35:00] mwat: has joined #RubyOnRails
[20:35:06] tubbo: ACTION hands out the jazz cigarettes
[20:36:04] mwat: has joined #RubyOnRails
[20:36:25] rhizome: :thumbsup:
[20:36:31] matthewd: glundgren: ??\_(???)_/??... I'm just not sure how to reconcile a complaint about excessive political correctness, vs jokingly calling someone a racist, vs non-jokingly calling someone a dictator
[20:37:29] seank_: has joined #RubyOnRails
[20:38:25] VeryBewitching: ACTION likes menthol cigarettes.
[20:38:36] woods: @complaint.reconcile
[20:39:08] arup_r: I don't want manual parsing like http://stackoverflow.com/a/11211178/2767755 . I want rails to do it for me :(
[20:39:10] yfeldblum: has joined #RubyOnRails
[20:39:11] glundgren: matthewd: just grab a sit and watch Radar ban me without a reason
[20:39:26] chandlerbing: has joined #RubyOnRails
[20:40:04] VeryBewitching: s/without a reason/without a reason you can think of
[20:40:06] rhizome: you're like one of the children in the bernie mac show
[20:40:22] youngbaks: has joined #RubyOnRails
[20:40:27] rhizome: "America..."
[20:40:31] MartinEl_: has joined #RubyOnRails
[20:40:35] VeryBewitching: "Old enough to talk back's old enough to get fuuuucked up." - Bernie Mac
[20:41:02] glundgren: you said a bad word VeryBewitching i will make sure you get the proper sanctions
[20:41:17] mwat: has joined #RubyOnRails
[20:41:17] Radar: glundgren: be on your best behaviour
[20:41:21] woods: *sits back to watch everyone get banned
[20:41:37] Radar: glundgren: You know perfectly why you were banned last time.
[20:41:46] rhizome: it's not usually very hard to figure out who is on who's bad side
[20:42:28] axl_: has joined #RubyOnRails
[20:43:07] tubbo: popcorn time
[20:43:09] Radar: Actually, you've been a shit already today I see. I didn't see it initially because you were on my ignore.
[20:43:28] Radar: +b *!*@189.33.178.133
[20:43:31] Radar: +b glundgren*!*@*
[20:43:38] Radar: Radar kicked glundgren: are not welcome here. Go away.
[20:43:58] momomomomo_: has joined #RubyOnRails
[20:44:08] Radar: http://logs.ryanbigg.com/RubyOnRails#4364014 starts from there
[20:45:02] VeryBewitching: Looks like he's trolling for your tender affections Radar.
[20:45:11] Radar: VeryBewitching: Yup :)
[20:45:27] Radar: Yet another butthurt white man who lives in his mother's basement.
[20:45:33] Radar: "THE WOMEN ARE OPRESSING ME! HALP!"
[20:45:52] tubbo: well that one really is just a joke
[20:46:01] Radar: arup_r: submit it as Content-Type: application/json. Should do the trick.
[20:46:33] woods: that probably means he doesn't live in California, because it is hard to find a basement there
[20:46:33] Radar: Ugh, trains. amirite
[20:46:46] arup_r: where to put it? I am submitting the form as remote: true
[20:47:00] Radar: arup_r: that should be fine then
[20:47:07] Radar: steps to reproduce in a new app as per usual
[20:47:14] Radar: woods: IP resolves to Brazil somewhere
[20:47:20] woods: nailed it
[20:48:10] chandlerbing: has joined #RubyOnRails
[20:48:27] renegadeandy: rhizome: i thought of a way to save Schedule, before making days and timeslots. I could receive the form POST , strip out the schedule, do an event update, save, and then repeat after with the days and schedule, but I need to strip out 2 pieces of my params hash, how can I do that? : https://gist.github.com/renegadeandy/5aa018526ab0b1595371
[20:49:27] Radar: > arup_r wants help for an application]
[20:49:32] siddart: has joined #RubyOnRails
[20:49:34] Radar: > arup_r refuses to follow instructions to get that help
[20:49:41] Radar: and so the story continues onwards, forever
[20:49:47] arup_r: trying format => :json Radar
[20:49:49] Radar: very cyclical.
[20:49:55] arup_r: it will set the content-type
[20:49:57] Radar: That probably won't fix it.
[20:50:11] Radar: Hoping that you're setting that in the url option for the form and not on the form itself.
[20:50:14] zcreative: has joined #RubyOnRails
[20:50:32] arup_r: = form_for distribution_list, remote: true, format => :json, html: { id: "edit_distribution_list_#{distribution_list.id}" } do |f|
[20:50:33] zcreative: has joined #RubyOnRails
[20:50:39] arup_r: I will try now
[20:50:51] zcreative_: has joined #RubyOnRails
[20:51:39] renegadeandy: If anyone else can take a look at my question - I would appreciate it. I want to remove a specific piece of a hash???s contents
[20:51:41] nogic_: has joined #RubyOnRails
[20:52:08] Radar: arup_r: That probably won't work because format isn't an option on form_for.
[20:52:20] renegadeandy: https://gist.github.com/renegadeandy/5aa018526ab0b1595371
[20:52:45] danman: has joined #RubyOnRails
[20:52:46] Radar: renegadeandy: what have you tried?
[20:53:07] Radar: renegadeandy: I'm guessing you've tried params[:event][:schedule_attributes] and it didn't work and now you've come to us for help?
[20:53:27] renegadeandy: Radar: you read my mind
[20:53:44] Radar: renegadeandy: and you're about to explain how params[:event][:schedule_attributes] didn't work
[20:53:50] Radar: in great and elaborate detail
[20:53:55] renegadeandy: Radar: nope, you already know it didnt
[20:53:55] arup_r: request came as JSON. but params are same yet. https://gist.github.com/aruprakshit/7ea89fb779e9a40b9e5c#file-log2-txt
[20:54:35] rhizome: is a schedule composed of multiple events, or the other way around?
[20:54:51] renegadeandy: an event has one schedule. A schedule has many days, and a day has many timeslots
[20:55:11] renegadeandy: rhizome: and i want to update event in 2 steps, number 1 , extract schedule from params, without the days hash
[20:55:32] DEA7TH: has joined #RubyOnRails
[20:55:46] renegadeandy: save it, then use the original params with an id on schedule ,to update the saved schedule, allowing my validator on days to access the schedules start and end date
[20:56:13] c0py: has joined #RubyOnRails
[20:58:07] Lytol: has joined #RubyOnRails
[20:59:29] davidsj: has joined #RubyOnRails
[21:02:47] rhizome: you wouldn't happen to have tests for this whole chain of associations, wouldja?
[21:03:02] renegadeandy: rhizome: nope :(
[21:04:42] rhizome: well you should be able to save an event and everything else fall into place
[21:05:00] arup_r: i will parse manually.
[21:05:26] arup_r: sorry, I gave up for tonight
[21:05:50] renegadeandy: rhizome: it does???.but if you remember???.the days validation i posted???.https://gist.github.com/renegadeandy/5aa018526ab0b1595371 ??? won???t run, without the schedule being saved. So you asked - can you save the schedule before updating it with days , and im trying to workout how!
[21:06:07] rhizome: that validation may be better on Schedule
[21:06:12] dacks: has joined #RubyOnRails
[21:06:15] renegadeandy: using an reject if?
[21:06:40] rhizome: do you have validates_associated?
[21:06:54] rhizome: i'm not really driving at any particular solution
[21:07:40] renegadeandy: rhizome: this is what it has : https://gist.github.com/renegadeandy/5aa018526ab0b1595371
[21:07:52] renegadeandy: it doesn???t do validates_associated, because day has the validates itself
[21:08:22] renegadeandy: would a reject_if lambda in schedule have context of its own start_date and end_date as well as wday, i think it would
[21:08:49] Maletor: has joined #RubyOnRails
[21:11:16] EminenceHC: has joined #RubyOnRails
[21:11:24] defsdoor: has joined #RubyOnRails
[21:12:40] chandlerbing: has joined #RubyOnRails
[21:13:03] rhizome: that's a lot of complication for such a basic operation
[21:13:40] ivanskie: has joined #RubyOnRails
[21:13:57] ivanskie: has joined #RubyOnRails
[21:14:35] renegadeandy: well, it would let me reject a day if there is no wday with that record between start and end date.....
[21:14:46] renegadeandy: rhizome: wouldnt it?
[21:15:08] renegadeandy: its not that complicated either???just a lambda block with an if and some other bits and bobs in!
[21:15:13] htmldrum: has joined #RubyOnRails
[21:17:22] workmad3: has joined #RubyOnRails
[21:19:09] dacks: has left #RubyOnRails: ()
[21:20:28] renegadeandy: rhizome: wouldnt it be like : accepts_nested_attributes_for :days, :reject_if => lambda { |t| t['wday']=="" || !(self.schedule.start_date..self.schedule.end_date).includes?(t['wday'])}
[21:21:00] tubbo: i accept nested attributes for dayyyyyyzzzzzzz
[21:24:48] IFrank00: has joined #RubyOnRails
[21:25:48] workmad3: has joined #RubyOnRails
[21:25:55] colleenmcguckin: has joined #RubyOnRails
[21:26:30] ellisTAA: has joined #RubyOnRails
[21:26:48] momomomomo: has joined #RubyOnRails
[21:27:30] ellisTAA: i???m trying to create a link for user to hit users/logout, but i can???t find syntax on the documentation, so far i have <%= link_to "Sign Out", users_path() %>, how do i add the logout part to this?
[21:28:06] rhizome: what's your sign out action?
[21:28:08] craysiii: EllisTAA are you using devise or rolling your own?
[21:28:30] ellisTAA: signout action is called logout and i???m not using devise
[21:29:05] rhizome: renegadeandy: maybe, try it. i think validates_associated might straighten up the order of saving the way you were assuming with the "association in memory" part
[21:29:18] rhizome: EllisTAA: what controller, what actual method name in that controller?
[21:29:33] ellisTAA: oh sorry users controller, action is called logout
[21:29:45] choke: has joined #RubyOnRails
[21:29:50] agent_white: has joined #RubyOnRails
[21:29:52] woods: is devise recommended over creating an authentication system from scratch?
[21:29:59] rhizome: usually good to have a sessions controller for this stuff, but not important right now
[21:30:00] craysiii: do you have a route in routes.rb pointing to your controller action?
[21:30:14] rhizome: EllisTAA: you may need to set a name for it
[21:30:38] ellisTAA: rhizome: i have a route set up
[21:30:59] Radar: woods: yes
[21:31:05] rhizome: rake routes | grep sign what's in the left hand column for it?
[21:31:16] ellisTAA: i just didn???t see anything on docs specififying how to point to specific action
[21:31:20] woods: good to know
[21:31:30] woods: thanks /Radar
[21:31:40] craysiii: can you gist your routes.rb and controller?
[21:31:44] woods: that is not the correct command it seems
[21:33:52] andrew9184: has joined #RubyOnRails
[21:35:10] tenderlove: has joined #RubyOnRails
[21:36:37] chopin_: has joined #RubyOnRails
[21:37:19] jessemcgilallen: has joined #RubyOnRails
[21:38:10] seank_: has joined #RubyOnRails
[21:38:35] ivanskie: has joined #RubyOnRails
[21:39:33] ellisTAA: i just can???t seem to figure out how to specify a certain action without using this outdated way link_to "Label", :controller => :my_controller, :action => :index
[21:40:01] Radar: EllisTAA: what have you tried instead of that.
[21:40:08] Radar: EllisTAA: gist rake routes
[21:40:16] pwnd_nfsw: has joined #RubyOnRails
[21:40:21] ellisTAA: i???ve tried this: <li><%= link_to "Sign Out", users_path([:logout]) %></li>
[21:40:41] Radar: ACTION goes mad due to people not gisting when asked to
[21:40:43] Radar: thx EllisTAA
[21:40:45] adaedra: has joined #RubyOnRails
[21:40:49] ellisTAA: Radar: https://gist.github.com/ellismarte/38371ba6d95b48845f03
[21:40:57] Radar: ok, becoming less mad
[21:41:00] adaedra: ACTION waves
[21:41:01] Radar: https://gist.github.com/ellismarte/38371ba6d95b48845f03#file-routes-rb-L4
[21:41:10] Radar: EllisTAA: The thing on the left is the routing helper to use
[21:41:21] ellisTAA: oh >< i just called users_logout
[21:41:27] Radar: <%= link_to "Sign Out", users_logout_path %>
[21:41:27] craysiii: yes line 4. <%= link_to "Sign out", users_logout_path %>
[21:41:28] ellisTAA: Radar: thanks dude :)
[21:41:41] Radar: I would make it a DELETE route instead of a GET route
[21:42:02] ellisTAA: Radar: why?
[21:42:14] Radar: EllisTAA: <img src='/users/logout'>
[21:42:19] Radar: whoops, user is now logged out
[21:42:23] Radar: glhf debugging why
[21:42:35] craysiii: its more semantically clear IMO
[21:42:47] ellisTAA: i see cool ill do that
[21:43:35] VeryBewitching: Radar: They wouldn't be in my system.
[21:43:47] baweaver: has joined #RubyOnRails
[21:43:49] jenrzzz: has joined #RubyOnRails
[21:43:53] Radar: VeryBewitching: ?
[21:44:06] yfeldblum: has joined #RubyOnRails
[21:44:11] VeryBewitching: delete '/sign_out', to: 'sessions#sign_out'
[21:44:22] Radar: VeryBewitching: yes, that's what I do too
[21:45:10] craysiii: is that haml or something?
[21:45:29] VeryBewitching: craysiii: Is what HAML?
[21:45:34] andrew9184: has joined #RubyOnRails
[21:45:47] craysiii: delete '/sign_out', to: 'sessions#sign_out', but i realized thats probably a route definition
[21:46:04] craysiii: i didnt know you could use delete as such
[21:46:55] VeryBewitching: craysiii: Your controller destroy methods should be accessible only via delete.
[21:46:56] beauby: has joined #RubyOnRails
[21:47:36] craysiii: right i agree, i just didn't know you could define it as such. i'm used to using resources so it's done for me i guess
[21:49:21] craysiii: the more you know ~~~~
[21:49:24] seank_: has joined #RubyOnRails
[21:49:36] VeryBewitching: I've become accustomed to writing each route manually.
[21:49:40] cac: has joined #RubyOnRails
[21:50:00] IrishGringo: has joined #RubyOnRails
[21:50:07] renegadeandy: rhizome: doing this results in the same nil error : https://gist.github.com/renegadeandy/db4ca27a3105bdb8c8f6
[21:50:28] craysiii: is there a major benefit in doing so?
[21:51:22] renegadeandy: **i added validates_associated :days
[21:51:42] andrew9184: has joined #RubyOnRails
[21:53:19] tenderlove: has joined #RubyOnRails
[21:54:41] VeryBewitching: craysiii: I do it to be conscious of every path I'm opening, and why.
[21:54:52] VeryBewitching: craysiii: I also get more control over how the helpers are named.
[21:56:03] workmad3: craysiii: in other words - not a huge benefit as you can control most of that through arguments to the `resources` routes
[21:57:11] petricore: has joined #RubyOnRails
[21:57:33] colleenmcguckin: has joined #RubyOnRails
[21:57:39] VeryBewitching: workmad3: Also, resources creates some pretty strange helper names sometimes if you're omitting one of the actions; resources :model, only: [...]
[21:58:02] VeryBewitching: I'd prefer to just name everything myself, and it doesn't take long to write out some routes.
[21:58:37] ellisTAA: i???m trying to write the link_to for this route, i???ve got <%= link_to ???conversation???, user_conversation_messages() %> if i want to specify which user and which convo, do i just throw them in the parentheses and seperate them with commas?
[21:59:22] ellisTAA: oops forgot to provide gist https://gist.github.com/ellismarte/38371ba6d95b48845f03#file-routes-rb-L46
[21:59:30] Lytol: has joined #RubyOnRails
[21:59:34] renegadeandy: Can anybody please help me understand why i am getting undefined method start_date for my reject if clause : https://gist.github.com/renegadeandy/ea88a4ac9cc2bec720b0
[22:00:20] Ropeney: has joined #RubyOnRails
[22:00:38] workmad3: renegadeandy: because you're calling it on `self` (which is the class), not `t` (which is the instance)
[22:00:42] andrew9184: has joined #RubyOnRails
[22:01:33] choke: Working on using AMS and having an issue, in that where i'm calling it, seems to work -- doesn't serialize the data in the way i'd expect, in that it returns everything not just the data within the serializer. am i doing something wrong here? https://gist.github.com/ch0ke/a675a024ab8d7cec9cfb
[22:02:13] tenderlo_: has joined #RubyOnRails
[22:02:27] DEA7TH: has joined #RubyOnRails
[22:02:38] DiaLyrics: has joined #RubyOnRails
[22:02:49] craysiii: <%= link_to "Conversation", user_conversation_messages_path @user, @conversation %> should work
[22:04:55] renegadeandy: workmad3: both this : accepts_nested_attributes_for :days, :reject_if => lambda { |t| t['wday']=="" || !((t['start_date']..t['end_date']).includes?(t['wday']))}
[22:05:12] renegadeandy: accepts_nested_attributes_for :days, :reject_if => lambda { |t| t['wday']=="" || !((t.start_date..t.end_date).includes?(t['wday']))}
[22:05:25] renegadeandy: start_date is not part of days???it is part of the schedule model, the parent one
[22:06:32] theblang: has joined #RubyOnRails
[22:09:32] bruno-: has joined #RubyOnRails
[22:11:03] tenderlove: has joined #RubyOnRails
[22:15:47] montagesoftware: has joined #RubyOnRails
[22:16:34] dideler: has joined #RubyOnRails
[22:17:18] colleenmcguckin: has joined #RubyOnRails
[22:18:08] wethu: has joined #RubyOnRails
[22:19:08] montagesoftware: has joined #RubyOnRails
[22:20:56] nogic: has joined #RubyOnRails
[22:21:41] riotjones: has joined #RubyOnRails
[22:22:03] tariqc: has joined #RubyOnRails
[22:22:20] Fire-Dragon-DoL: has joined #RubyOnRails
[22:22:27] jessemcgilallen: has joined #RubyOnRails
[22:22:52] CanTonic: has joined #RubyOnRails
[22:23:28] Cervajz: has joined #RubyOnRails
[22:24:05] mary5030: has joined #RubyOnRails
[22:24:20] tuelz: has joined #RubyOnRails
[22:24:21] nya: has joined #RubyOnRails
[22:24:35] Majadon: has joined #RubyOnRails
[22:25:20] colleenmcguckin: has joined #RubyOnRails
[22:25:55] mary5030: has joined #RubyOnRails
[22:26:54] montagesoftware: has joined #RubyOnRails
[22:27:21] Fire-Dragon-DoL: has joined #RubyOnRails
[22:27:26] rubyonrailed: has joined #RubyOnRails
[22:27:41] CanTonic: has joined #RubyOnRails
[22:29:00] Radar: -bb *!*@189.33.178.133 glundgren!*@*
[22:30:45] yashinbasement: has joined #RubyOnRails
[22:31:05] EminenceHC: has joined #RubyOnRails
[22:31:58] siaW: has joined #RubyOnRails
[22:32:49] montagesoftware: has left #RubyOnRails: ("Ex-Chat")
[22:32:58] arthurix: has joined #RubyOnRails
[22:33:26] rubyonrailed: has joined #RubyOnRails
[22:34:49] trosborn: has joined #RubyOnRails
[22:36:17] renegadeandy: workmad3: ?? can you help ^^
[22:38:01] edwinvdgraaf: has joined #RubyOnRails
[22:38:42] Radar: -b glundgren!*@*
[22:40:48] mary5030: has joined #RubyOnRails
[22:41:19] hahuang65: has joined #RubyOnRails
[22:42:07] EminenceHC: has joined #RubyOnRails
[22:45:44] roxtrongo: has joined #RubyOnRails
[22:45:47] rdavila: has joined #RubyOnRails
[22:46:05] tuelz: has joined #RubyOnRails
[22:46:53] ellisTAA: how can i link_to this route ??? since it doesn???t have a prefix? do i create that prefix in my route file?
[22:46:53] Fire-Dra_: has joined #RubyOnRails
[22:46:54] ellisTAA: https://gist.github.com/ellismarte/38371ba6d95b48845f03#file-routes-rb-L11
[22:46:55] podman: has joined #RubyOnRails
[22:48:40] bonhoeffer_: has joined #RubyOnRails
[22:48:42] andrew9184: has joined #RubyOnRails
[22:49:51] Fire-Dragon-DoL: has joined #RubyOnRails
[22:50:47] quazimodo: has joined #RubyOnRails
[22:51:42] lea: has joined #RubyOnRails
[22:52:58] symbol: has joined #RubyOnRails
[22:53:22] ivanskie: has joined #RubyOnRails
[22:53:26] rubyonrailed: has joined #RubyOnRails
[22:53:51] choke: has joined #RubyOnRails
[22:54:43] choke: Working on using AMS and having an issue, in that where i'm calling it, seems to work -- doesn't serialize the data in the way i'd expect, in that it returns everything not just the data within the serializer. am i doing something wrong here? https://gist.github.com/ch0ke/a675a024ab8d7cec9cfb
[22:55:49] IFrank00: has joined #RubyOnRails
[22:57:51] sloggerkhan: has joined #RubyOnRails
[22:58:31] GnuYawk: has joined #RubyOnRails
[22:58:54] roxtrongo: has joined #RubyOnRails
[22:59:21] Slogger: I'm trying to get websockets to work via a simple nginx reverse proxy and I keep getting Request origin not allowed.
[22:59:56] EminenceHC: has joined #RubyOnRails
[23:00:14] Lytol: has joined #RubyOnRails
[23:00:18] kies: has joined #RubyOnRails
[23:00:19] Slogger: It's apparently set to https://<my site's address>. I'm not sure what it should be set to.
[23:00:42] Slogger: Using Actioncable.
[23:03:16] tenderlove: has joined #RubyOnRails
[23:03:23] bonhoeffer_: has joined #RubyOnRails
[23:03:50] nya: has joined #RubyOnRails
[23:04:11] kies^: has joined #RubyOnRails
[23:04:40] AzaToth: has joined #RubyOnRails
[23:10:24] shinnya: has joined #RubyOnRails
[23:13:29] tenderlove: has joined #RubyOnRails
[23:20:02] renegadeandy: Can some brave validations guru help here please : https://gist.github.com/renegadeandy/ea88a4ac9cc2bec720b0
[23:20:44] erich: has joined #RubyOnRails
[23:21:28] Fire-Dragon-DoL: has joined #RubyOnRails
[23:21:35] shmilan: has joined #RubyOnRails
[23:21:54] andersoldahl: has joined #RubyOnRails
[23:22:34] choke: bit advanced for what i've had to do, but wouldn't it technically be self.start_date..self.end_date ?
[23:22:48] nya: has joined #RubyOnRails
[23:22:58] tenderlo_: has joined #RubyOnRails
[23:23:01] choke: i mean logically, within a lambda that's what i'd expect
[23:23:49] CanTonic: has joined #RubyOnRails
[23:24:17] jgpawletko: has joined #RubyOnRails
[23:27:40] one_zero: has joined #RubyOnRails
[23:28:11] tuelz: has joined #RubyOnRails
[23:28:47] stannard: has joined #RubyOnRails
[23:29:04] chills42: has joined #RubyOnRails
[23:29:24] weaksauce: renegadeandy what does the days class look like?
[23:29:54] crankharder: is there a way to make images available without their manifest hash appended? it seems that just /assets/foo.png is 404ing when /assets/foo-<the hash>.png works just fine
[23:30:49] blackhuey: has joined #RubyOnRails
[23:31:50] yfeldblum: has joined #RubyOnRails
[23:32:14] nettoweb: has joined #RubyOnRails
[23:32:31] tenderlove: has joined #RubyOnRails
[23:35:08] hmsimha: has joined #RubyOnRails
[23:38:39] rhizome: crankharder: why is that an issue, i.e. why are you touching that?
[23:38:48] Slogger: Okay, figured out that "config.allowed_request_origins" was added and I just need to set it to match server.
[23:39:23] Slogger: New behavior: in production env. constant triggering of "connected" while in dev "connected" only occurs once.
[23:41:04] pydave6367: has joined #RubyOnRails
[23:41:26] RockLee: has joined #RubyOnRails
[23:42:37] crankharder: hardcoded clients
[23:42:44] tenderlove: has joined #RubyOnRails
[23:43:03] crankharder: doesn't matter that the asset gets cached
[23:43:30] jhass: like JS client delivered by your rails app?
[23:47:11] quazimodo: has joined #RubyOnRails
[23:48:45] sunya7a: has joined #RubyOnRails
[23:50:09] acovrig: has joined #RubyOnRails
[23:50:36] tenzan: has joined #RubyOnRails
[23:50:38] nettoweb: has joined #RubyOnRails
[23:50:39] iateadonut: has joined #RubyOnRails
[23:50:51] acovrig: I???m having cross-domain issues: I want to POST to the API (rails) from JavaScript in an HTML file on localhost, is this possible?
[23:51:10] hephaestus_rg: has joined #RubyOnRails
[23:51:28] mary5030: has joined #RubyOnRails
[23:51:55] tenderlo_: has joined #RubyOnRails
[23:51:56] ngscheurich: has joined #RubyOnRails
[23:53:22] andrew9184: has joined #RubyOnRails
[23:54:08] wldcordeiro: has joined #RubyOnRails
[23:55:06] nya: has joined #RubyOnRails
[23:55:45] corioliss: has joined #RubyOnRails
[23:56:54] mrbubbles: has joined #RubyOnRails
[23:57:38] sevenseacat: has joined #RubyOnRails
[23:59:58] greengriminal: has joined #RubyOnRails