« Back to channel list

#RubyOnRails - 03 May 2018

« Back 1 day Forward 1 day »
[00:00:09] uks: has joined #RubyOnRails
[00:04:45] gheegh: has joined #RubyOnRails
[00:05:51] alfiemax: has joined #RubyOnRails
[00:06:32] eckhardt_: has joined #RubyOnRails
[00:21:06] amperry: has joined #RubyOnRails
[00:23:31] amperry: hi folks, got a question. It looks like, with cocoon, you can't transitively add an association through belongs_to -> has_many. In more concrete terms, my model, Lease belongs_to the model Placement, which has_many MonthlyCharges. I'm trying to use cocoon's link_to_add_association to add one or more MonthlyCharges to the Lease. gist here: https://gist.github.com/amp108/b18acf50ac9395af19324aac55c49257
[00:24:17] amperry: seems like you maybe can't do that, but I'm wondering what my options might be at this point.
[00:24:35] kapil___: has joined #RubyOnRails
[00:25:22] alfiemax: has joined #RubyOnRails
[00:25:46] Aherin: has joined #RubyOnRails
[00:28:05] cagomez: has joined #RubyOnRails
[00:35:31] d3ram1us: has joined #RubyOnRails
[00:47:32] cam27: has joined #RubyOnRails
[01:03:01] alfiemax: has joined #RubyOnRails
[01:09:35] mlt-: has joined #RubyOnRails
[01:11:59] cagomez: has joined #RubyOnRails
[01:14:19] eckhardt_: has joined #RubyOnRails
[01:16:50] cschneid_: has joined #RubyOnRails
[01:18:42] mlt-: has joined #RubyOnRails
[01:28:39] alfiemax: has joined #RubyOnRails
[01:38:51] AnotherOne: has joined #RubyOnRails
[01:46:24] cschneid_: has joined #RubyOnRails
[01:53:48] alfiemax: has joined #RubyOnRails
[02:01:46] sevenseacat: has joined #RubyOnRails
[02:01:57] cschneid_: has joined #RubyOnRails
[02:19:36] Saukk: has joined #RubyOnRails
[02:31:31] Technodrome: has joined #RubyOnRails
[02:35:49] Tempesta: has joined #RubyOnRails
[02:39:20] cjohnson: has joined #RubyOnRails
[02:42:43] alfiemax: has joined #RubyOnRails
[02:53:16] orbyt_: has joined #RubyOnRails
[02:56:47] mroutis: has joined #RubyOnRails
[03:31:29] Technodrome: has joined #RubyOnRails
[03:55:04] alfiemax: has joined #RubyOnRails
[04:32:22] orbyt_: has joined #RubyOnRails
[04:36:14] mroutis: has joined #RubyOnRails
[05:03:29] woohoou: has joined #RubyOnRails
[05:07:42] EXCHGR: has joined #RubyOnRails
[05:12:05] Technodrome: has joined #RubyOnRails
[05:16:27] apeiros: has joined #RubyOnRails
[05:19:37] ur5us: has joined #RubyOnRails
[05:21:05] FooBarWidget: has joined #RubyOnRails
[05:41:44] ur5us: has joined #RubyOnRails
[06:03:25] ur5us: has joined #RubyOnRails
[06:24:42] Technodrome: has joined #RubyOnRails
[06:25:18] ur5us: has joined #RubyOnRails
[06:32:15] elcms: has joined #RubyOnRails
[06:32:53] _aeris_: has joined #RubyOnRails
[06:35:05] DrYockel: has joined #RubyOnRails
[06:37:59] jane_booty_doe: has joined #RubyOnRails
[06:42:06] dionysus69: has joined #RubyOnRails
[06:43:55] elcms: has joined #RubyOnRails
[06:46:51] ur5us: has joined #RubyOnRails
[07:02:50] eckhardt_: has joined #RubyOnRails
[07:02:51] s2013: has joined #RubyOnRails
[07:08:42] ur5us: has joined #RubyOnRails
[07:19:15] dionysus69: has joined #RubyOnRails
[07:22:47] cabotto: has joined #RubyOnRails
[07:30:38] ur5us: has joined #RubyOnRails
[07:34:00] schneider-: has joined #RubyOnRails
[07:39:03] Technodrome: has joined #RubyOnRails
[07:41:24] jottr: has joined #RubyOnRails
[07:43:04] _cabotto: has joined #RubyOnRails
[07:43:13] jonno112: has joined #RubyOnRails
[07:54:15] defsdoor: has joined #RubyOnRails
[07:58:41] alfiemax: has joined #RubyOnRails
[08:08:13] marr: has joined #RubyOnRails
[08:19:07] schneider-: has joined #RubyOnRails
[08:20:05] lord4163: has joined #RubyOnRails
[08:56:07] conta: has joined #RubyOnRails
[09:06:30] za1b1tsu: has joined #RubyOnRails
[09:11:14] ur5us: has joined #RubyOnRails
[09:13:04] srinidhi: has joined #RubyOnRails
[09:13:32] jottr: has joined #RubyOnRails
[09:23:19] cabotto: has joined #RubyOnRails
[09:27:15] drale2k_: has joined #RubyOnRails
[09:31:27] _cabotto: has joined #RubyOnRails
[09:32:13] quazimodo: has joined #RubyOnRails
[09:37:41] jane_booty_doe: has joined #RubyOnRails
[09:44:00] schneider-: has joined #RubyOnRails
[09:47:48] jottr: has joined #RubyOnRails
[10:05:05] dminuoso: has joined #RubyOnRails
[10:05:21] dminuoso: So. The most amazing thing Ive started is passing parameters explicitly from controllers into views.
[10:05:36] dminuoso: This de-facto global shenanigans with assigning to ivars is the worst idea about rails.
[10:16:50] Fernando-Basso: has joined #RubyOnRails
[10:23:44] roshanavand: has joined #RubyOnRails
[10:24:04] schneider-: has joined #RubyOnRails
[10:24:10] roshanavand: has joined #RubyOnRails
[10:29:32] defsdoor: has joined #RubyOnRails
[10:33:57] s2013: has joined #RubyOnRails
[10:35:28] ur5us: has joined #RubyOnRails
[10:42:45] Linuus`: has joined #RubyOnRails
[10:48:37] jottr: has joined #RubyOnRails
[10:53:04] Saukk: has joined #RubyOnRails
[10:55:15] Radar: dminuoso: strongly agree
[10:55:44] Radar: dminuoso: is now the time to mention that hanami does this through action exposures? http://hanamirb.org/guides/1.0/actions/exposures/
[10:55:57] Radar: Variables go from actions -> view classes -> template
[10:58:13] jottr: has joined #RubyOnRails
[10:59:42] Linuus: has joined #RubyOnRails
[11:00:11] schneider-: has joined #RubyOnRails
[11:02:49] ams__: has joined #RubyOnRails
[11:06:49] ellcs: has joined #RubyOnRails
[11:07:59] cschneid_: has joined #RubyOnRails
[11:23:07] Cavallari: has joined #RubyOnRails
[11:29:44] dminuoso: Radar: Looks like trailblazer cells
[11:30:14] dminuoso: Or.. idk what is this
[11:36:45] za1b1tsu: has joined #RubyOnRails
[11:39:20] ldnunes: has joined #RubyOnRails
[11:44:45] jottr: has joined #RubyOnRails
[11:46:40] dionysus69: has joined #RubyOnRails
[11:51:13] Cavallari: has joined #RubyOnRails
[11:51:55] nzst: has joined #RubyOnRails
[11:53:50] za1b1tsu: has joined #RubyOnRails
[11:54:28] schneider-: has joined #RubyOnRails
[12:02:31] ferr: has joined #RubyOnRails
[12:03:34] za1b1tsu: has joined #RubyOnRails
[12:05:39] DoubleMalt: has joined #RubyOnRails
[12:11:07] elcms: has joined #RubyOnRails
[12:16:39] drale2k_: has joined #RubyOnRails
[12:42:01] cabotto: has joined #RubyOnRails
[12:48:02] za1b1tsu: has joined #RubyOnRails
[12:48:48] schneider-: has joined #RubyOnRails
[12:59:13] sevenseacat: I would also much prefer to explicitly assign variables to views, its one of the things that surprised me coming to Rails
[13:00:30] _aeris_: has joined #RubyOnRails
[13:02:10] za1b1tsu: has joined #RubyOnRails
[13:02:33] quazimodo: has joined #RubyOnRails
[13:04:22] _aeris_: has joined #RubyOnRails
[13:08:46] roshanavand: has joined #RubyOnRails
[13:11:05] ferr: has left #RubyOnRails: ("WeeChat 2.1")
[13:11:32] quazimodo: has joined #RubyOnRails
[13:12:10] deramius: has joined #RubyOnRails
[13:13:29] roshanavand: has joined #RubyOnRails
[13:17:41] cabotto: has joined #RubyOnRails
[13:19:32] cabotto: has joined #RubyOnRails
[13:22:16] Technodrome: has joined #RubyOnRails
[13:24:00] rfoust: has joined #RubyOnRails
[13:27:43] vasilakisFiL: has joined #RubyOnRails
[13:29:42] dminuoso: sevenseacat: You can do it. The rails documentations just do their best to keep it a secret.
[13:32:54] dionysus69: has joined #RubyOnRails
[13:37:31] mrbubbles: has joined #RubyOnRails
[13:38:27] AzaToth: has joined #RubyOnRails
[13:40:08] dionysus69: has joined #RubyOnRails
[13:40:09] schneider-: has joined #RubyOnRails
[13:41:13] mrbubbles: Hey folks, I was just hoping someone can advise on using accepts_nested_attributes_for. Here is a minimal recreation of my issue: https://gist.github.com/joeczucha/26b25bf65f74c34f613c2667c7d84503
[13:41:52] mrbubbles: Basically A and C are joined through join model B. I want to create a new C and at the same time create a join record B, with a couple of attributes
[13:42:40] mrbubbles: But when I use accepts_nested_attributes_for C is able to create B but doesn't include the ID of A so it fails
[13:42:43] mrbubbles: Hopefully my gist will make sense :)
[13:52:22] dionysus69: has joined #RubyOnRails
[13:53:47] elcms: has joined #RubyOnRails
[13:58:41] dionysus69: has joined #RubyOnRails
[14:00:06] dionysus69: has joined #RubyOnRails
[14:13:10] dionysus69: has joined #RubyOnRails
[14:18:11] dionysus69: has joined #RubyOnRails
[14:26:03] schneider-: has joined #RubyOnRails
[14:26:15] Technodrome: has joined #RubyOnRails
[14:31:02] apparition: has joined #RubyOnRails
[14:33:32] jottr: has joined #RubyOnRails
[14:37:46] cabotto: has joined #RubyOnRails
[14:41:38] nzst: has joined #RubyOnRails
[14:47:12] schneider-: has joined #RubyOnRails
[14:48:22] marr: has joined #RubyOnRails
[14:50:17] cabotto: has joined #RubyOnRails
[14:50:41] jammanbo: has joined #RubyOnRails
[14:54:54] jammanbo: Is this a bad idea. A controller action might take some time, or it might not. I was going to try and put the slow running stuff in an async ActiveJob, but somehow wait a few seconds within the controller to see if the job finishes. If it does, send one response, if it doesn't, send another. Rails 4 so ActionCable isn't a ready alternative.
[14:55:36] jammanbo: I mean obviously it is a bad idea. Alternative?
[15:13:11] troys: has joined #RubyOnRails
[15:22:28] schneider-: has joined #RubyOnRails
[15:24:36] jnollette: has joined #RubyOnRails
[15:31:58] Technodrome: has joined #RubyOnRails
[15:38:13] schneider-: has joined #RubyOnRails
[15:40:17] alfiemax: has joined #RubyOnRails
[15:46:31] cagomez: has joined #RubyOnRails
[15:47:19] cagomez: has joined #RubyOnRails
[15:49:37] jcarl43: has joined #RubyOnRails
[15:51:43] AnotherOne: has joined #RubyOnRails
[15:53:05] bjbryant: has joined #RubyOnRails
[16:09:01] alfiemax: has joined #RubyOnRails
[16:17:07] Technodrome: has joined #RubyOnRails
[16:25:00] alfiemax: has joined #RubyOnRails
[16:27:50] pabst: has joined #RubyOnRails
[16:30:29] webdestroya: has joined #RubyOnRails
[16:35:08] agent_white: has joined #RubyOnRails
[16:37:36] eckhardt_: has joined #RubyOnRails
[16:41:53] orbyt_: has joined #RubyOnRails
[16:44:53] conta: has joined #RubyOnRails
[16:47:11] saltlake: has joined #RubyOnRails
[16:47:28] saltlake: has left #RubyOnRails: ()
[16:49:18] Saukk: has joined #RubyOnRails
[16:52:22] conceivably: has joined #RubyOnRails
[16:52:30] SanguineAnomaly: has joined #RubyOnRails
[16:53:08] cabotto: has joined #RubyOnRails
[16:54:31] conceivably: Hi. What do people use to generate pdfs from HTML views these days? Wicked PDF's backend doesn't properly support modern CSS due to an ancient webkit version.
[17:00:06] deramius: has joined #RubyOnRails
[17:00:33] Technodrome: has joined #RubyOnRails
[17:03:22] alfiemax: has joined #RubyOnRails
[17:29:52] jottr: has joined #RubyOnRails
[17:30:56] blackcross: I have a "def get_cache_ndc" in line_items_controller.rb, how would I include this in another controller? namely, "home_controller.rb"
[17:31:46] tbuehlmann: blackcross: you could define it in a module and include it in both controllers. you could also define it on a shared parent controller
[17:31:58] tbuehlmann: what does it do? is that really necessary?
[17:36:36] blackcross: it queries a model, @line_item = line_item.find_by(drug_code: CODE) and if it finds it, returns @line_item, if not, it queues 10 other models, and copies all those attributes into a @line_item.new, then returns @line_item
[17:36:58] blackcross: yes, it's necessary to use it in 2 controllers
[17:38:42] blackcross: so how would i just include that 1 "def get_cache_ndc" into another controller? I tried require get_cache_ndc and require line_item_controller, and include line_item_controller and include get_cache_ndc, but none work
[17:39:09] blackcross: i am pretty sure this is just basic ruby i am asking about, but even google doesn't have documentation on how to directly include 1 definition
[17:41:40] tbuehlmann: I'll gist something
[17:42:11] blackcross: looks like i can do "require line_items_controller.rb", but this makes all the definitions accessible, which i do not want
[17:46:43] tbuehlmann: so, this is one way: https://gist.github.com/tbuehlmann/907617d1b0cef102a52ac071be2c52ec
[17:47:58] blackcross: awesome, so modules go in concerns
[17:48:22] alfiemax: has joined #RubyOnRails
[17:48:34] tbuehlmann: yes, that directory is autoloaded, so you don't have to require the file
[17:49:00] tbuehlmann: another option: https://gist.github.com/tbuehlmann/1d601c9a2c6bc812e6771b31ae06befa
[17:49:23] tbuehlmann: with that the cache_ndc method would be available in each controller that inherits from ApplicationController. that might be too much though
[17:55:01] blackcross: I went with the first option, using modules seems cleaner in the long run
[17:55:11] blackcross: thank you for the help and especially this gists
[17:55:44] ur5us: has joined #RubyOnRails
[17:56:01] Technodrome: has joined #RubyOnRails
[17:56:42] tbuehlmann: you're welcome
[18:12:02] weaksauce: has joined #RubyOnRails
[18:13:09] mondongo: has joined #RubyOnRails
[18:15:21] conceivably: has joined #RubyOnRails
[18:17:08] NoGodDamnIdea: has joined #RubyOnRails
[18:17:21] Puffball: has joined #RubyOnRails
[18:23:17] Inside: has joined #RubyOnRails
[18:23:21] DrYockel: has joined #RubyOnRails
[18:24:10] Inside: So - something weird happened. I upgraded to rails 4.2 (yaaay) and then the production environment refused to start up because I had an invalid validation (was calling "validate :name_of_attributes" instead of validates: ).
[18:24:18] Inside: How is it that this was not an issue before?
[18:24:41] sameerynho: has joined #RubyOnRails
[18:35:46] j0bk: has joined #RubyOnRails
[18:35:48] fryguy: is this a commonly used model?
[18:45:52] DrYockel: has joined #RubyOnRails
[18:48:59] roshanavand: has joined #RubyOnRails
[19:07:33] Inside: fryguy: it's actually dead code that hasn't been used in 2 years
[19:07:45] Inside: but it's never been an issue with the passenger process starting up
[19:08:44] fryguy: did you change eager loading settings during the upgrade
[19:09:12] Inside: I don't think so - that happens in the 4.2->5.0 upgrade
[19:09:48] Inside: Might be a ruby thing - I went from 2.1.2 to 2.4.0 on the same upgrade
[19:10:40] Inside: Upgrading from 4.2 all the way up to 5.2 is going to be .. fun :|
[19:11:19] Inside: (I was stuck at 4.1 because we were running sql server 2005 for the longest time and sql-adapter-4.2+ doesn't support it -- finally we moved to 2014 or something)
[19:12:54] fryguy: eager loading definitely exists in 4.x, you should double check that
[19:19:40] jtperreault: has joined #RubyOnRails
[19:24:16] NoGodDamnIdea: has joined #RubyOnRails
[19:26:52] cagomez: has joined #RubyOnRails
[19:28:59] Fridtjof: has joined #RubyOnRails
[19:34:32] Technodrome: has joined #RubyOnRails
[19:48:12] orbyt_: has joined #RubyOnRails
[19:51:34] deramius: has joined #RubyOnRails
[20:06:41] jackhum: has joined #RubyOnRails
[20:09:11] alfiemax: has joined #RubyOnRails
[20:11:57] jackhum: has joined #RubyOnRails
[20:21:48] cagomez: has joined #RubyOnRails
[20:29:18] Technodrome: has joined #RubyOnRails
[20:32:37] alfiemax: has joined #RubyOnRails
[20:35:48] deramius: has joined #RubyOnRails
[20:45:07] elcms: has joined #RubyOnRails
[20:45:48] NoGodDamnIdea: has joined #RubyOnRails
[21:04:14] ur5us: has joined #RubyOnRails
[21:08:27] Technodrome: has joined #RubyOnRails
[21:08:30] tfitts: has joined #RubyOnRails
[21:11:06] orbyt_: has joined #RubyOnRails
[21:12:01] defsdoor: has joined #RubyOnRails
[21:17:04] openstruct: has joined #RubyOnRails
[21:19:00] openstruct: I've been building a lot of dashboards recently that manage multiple resources and have been wrestling with the best way to handle CRUD actions. For example, given a product dashboard that manages cameras, lens, and tripods, should the ProductDashboardController handle the CRUD operations or should the individual resource controllers handle those? It seems like the individual resource controllers should be responsible instead
[21:32:38] ur5us: has joined #RubyOnRails
[21:32:46] Inside: I've been really trying to have a controller per model
[21:33:00] Inside: Then there's no confusion about what controller should handle which resource
[21:35:24] openstruct: Yeah, that's what I feel like it's most appropriate to have the dashboard forms call to their respective endpoints.
[21:43:59] mlt-: has joined #RubyOnRails
[21:45:56] cagomez: +1 for individual resources. at the expense of more files, the controllers will be easy to reason about and test
[21:48:23] cagomez: has joined #RubyOnRails
[21:51:59] deramius: has joined #RubyOnRails
[21:54:32] orbyt_: has joined #RubyOnRails
[22:00:54] alfiemax: has joined #RubyOnRails
[22:02:55] Radar: GOOD MORNING
[22:03:20] Radar: +1 also for individual resources
[22:03:43] Radar: A controller that has hundreds of lines in it to manage > 1 resource is a prime target for a good ol' refactoring.
[22:04:14] Radar: Although this is coming from me, who has 7 models but only two controllers.
[22:04:39] Radar: ./nick hypocrite
[22:05:05] Radar: But no, #realtalk time, I only _need_ two actions in my app: https://github.com/radar/twist-v2/tree/master/backend/apps/web/controllers
[22:10:04] openstruct: The only part that feels hairy to me is handling redirects and errors, but that's just because the front-end of this app isn't fleshed out to handle those. I think once I get it nailed down, it should be pretty easy to write dashboards on dashboards on dashboards.
[22:10:44] openstruct: Also, those are neat endpoints.
[22:25:30] Radar: Those are the beautiful mask that hides the absolutely atrocious Markdown sins I am committing elsewhere.
[22:25:41] Radar: Parsing Markdown with regex? More than once? SURE!
[22:31:36] Technodrome: has joined #RubyOnRails
[23:03:57] dviola: has joined #RubyOnRails
[23:12:21] eckhardt_: has joined #RubyOnRails
[23:20:31] Intii: has joined #RubyOnRails
[23:21:06] Intii: Hey all, I have a query that runs inside ActiveRecord.transaction do to do a rollback in case something fails. In that block I update a column in the user's table that shouldn't rollback regardless of the fail or not. Is there anyway to achieve that?
[23:21:18] Intii: I've tried both user.update_attribute and user.update_column to no avail.
[23:23:21] orbyt_: has joined #RubyOnRails
[23:31:17] Intii: has joined #RubyOnRails
[23:31:40] Intii: Not sure if anyone responded, I lost connection...
[23:52:40] alfiemax: has joined #RubyOnRails