« Back to channel list

#RubyOnRails - 16 March 2018

« Back 1 day Forward 1 day »
[00:01:43] alfiemax: has joined #RubyOnRails
[00:18:25] alfiemax: has joined #RubyOnRails
[00:20:32] ResidentBiscuit: has joined #RubyOnRails
[00:23:04] brycesenz: has joined #RubyOnRails
[00:34:43] dviola: has joined #RubyOnRails
[00:41:59] gravity_pope: has joined #RubyOnRails
[00:44:19] gravity_pope: has joined #RubyOnRails
[00:45:57] cawel: has joined #RubyOnRails
[00:46:32] baweaver: has joined #RubyOnRails
[00:51:43] Dimik: has joined #RubyOnRails
[00:52:51] alfiemax: has joined #RubyOnRails
[00:55:24] Jameser: has joined #RubyOnRails
[00:58:09] Jameser: has joined #RubyOnRails
[01:00:24] epochwolf: has joined #RubyOnRails
[01:01:17] mostlybadfly: has joined #RubyOnRails
[01:05:54] alfiemax: has joined #RubyOnRails
[01:06:54] mroutis: has joined #RubyOnRails
[01:50:11] epochwolf: has joined #RubyOnRails
[01:59:06] sevenseacat: has joined #RubyOnRails
[02:02:53] alfiemax: has joined #RubyOnRails
[02:19:26] Frenchiie: has joined #RubyOnRails
[02:20:49] Frenchiie: sup guys. I have a list of objects passed to my erb file. I'm iterating through the list, for each how do i check if for a certain attribute it's set to anything
[02:21:07] Radar: Frenchiie: Can you show us how you're iterating?
[02:21:08] helpa: Show rather than tell. Explaining your problem with code, stacktraces or errors is always preferred to explaining it with just text. Show us what's happening, rather than telling us. Put the code on https://gist.github.com and then give us the HTTP link to the Gist.
[02:23:39] gravity_pope: has joined #RubyOnRails
[02:25:02] nachoman: has joined #RubyOnRails
[02:25:03] Frenchiie: Radar: https://paste.ofcode.org/fM4wrUi9r793Grc7DKYk7r
[02:25:33] Frenchiie: name is an attribute of the object model, i want to check if it was set to anything though or if it's empty
[02:25:47] Radar: Close enough.
[02:25:58] Radar: Frenchiie: <% if user.name.blank? %>
[02:27:34] gravity_pope: has joined #RubyOnRails
[02:28:48] ghormoon: has joined #RubyOnRails
[02:30:41] ghormoon: has joined #RubyOnRails
[02:32:51] darkhanb: has joined #RubyOnRails
[02:35:14] universa1: has joined #RubyOnRails
[02:56:45] kn-928: has joined #RubyOnRails
[03:14:28] syndikate: Did not get time to share the gist I had discussed yesterday, will try to get that today. (Caught up with work)
[03:16:19] syndikate: Not sure if any convention or pattern exists for this, saw this thing in one of the projects. There are a set of default values required for certain model-object creation, they can't go into the table default values. So, they are defined in an external file and is read during creation time. Is there a specific pattern to follow for this?
[03:16:33] syndikate: The code is un-necessarily complicated and I was wondering if they could exist in the model itself
[03:29:59] Jameser: has joined #RubyOnRails
[03:31:45] Saukk: has joined #RubyOnRails
[03:38:59] dnewkerk: has joined #RubyOnRails
[03:43:28] roshanavand: has joined #RubyOnRails
[03:47:19] Ryzokuken: has joined #RubyOnRails
[03:47:50] Frenchiie: has joined #RubyOnRails
[03:49:43] Frenchiie: question! i have a model object in my controller and i have a method that i'd like to call and make reference to the object attributes in that method. Is there an easy way to get the attributes of that object inside the model method? https://paste.ofcode.org/VFTHj6GtaRx7wF5jTviDJt
[03:49:49] Radar: syndikate: can we cover what we were doing yesterday firsT?
[03:49:56] Radar: syndikate: I'm still waiting for that code example.
[03:50:07] Frenchiie: in django for example i would do object.model_method() and call self.attribute_name inside the model_method
[03:50:32] sevenseacat: Frenchiie: does that code work?
[03:50:32] syndikate: Radar, Oh, okay. I did not know that you were actually eager about. Sure, give me sometime. Sorry about that.
[03:50:52] Radar: Frenchiie: `self.name` should work there. `name` will also work.
[03:51:15] Radar: syndikate: I thought you were eager to solve your problem related to that code?
[03:51:16] Frenchiie: oh so self makes reference to the object then?
[03:51:20] Radar: Frenchiie: yes
[03:51:30] Frenchiie: cool thanks
[03:51:32] Radar: syndikate: I thought that we wouldn't be able to solve your problem without that code. So yes, I'm still expecting to se eit.
[03:51:52] Radar: Frenchiie: This is pretty basic Ruby and so maybe taking the time to read a Ruby book might help you here.
[03:51:57] syndikate: Radar, yeah I was. Actually I still am. I have few problems in queue, since I did not get time to get that snippet I thought I will share another one I faced.
[03:52:05] Radar: syndikate: Up to you.
[03:52:14] syndikate: Radar, nope, the first one is coming in a while.
[03:53:04] brycesenz: has joined #RubyOnRails
[03:56:57] Radar: syndikate: Also regarding this new problem...
[03:56:59] Radar: syndikate: !rule0
[03:56:59] helpa: syndikate: Show rather than tell. Explaining your problem with code, stacktraces or errors is always preferred to explaining it with just text. Show us what's happening, rather than telling us. Put the code on https://gist.github.com and then give us the HTTP link to the Gist.
[04:01:01] cawel: has joined #RubyOnRails
[04:01:01] syndikate: Gotcha Radar. Point noted
[04:16:14] Omnilord: has joined #RubyOnRails
[04:18:57] orbyt_: has joined #RubyOnRails
[04:25:14] trautwein: has joined #RubyOnRails
[04:27:45] syndikate: Radar, https://gist.github.com/anonymous/0e5051aaefc05f0cbcf462d97733f059
[04:31:06] gravity_pope: has joined #RubyOnRails
[04:33:05] srinidhi: has joined #RubyOnRails
[05:05:54] unreal_: has joined #RubyOnRails
[05:17:42] mroutis: has joined #RubyOnRails
[05:38:24] mroutis_: has joined #RubyOnRails
[05:40:12] srinidhi: has joined #RubyOnRails
[05:40:16] ltd: has joined #RubyOnRails
[05:43:10] ltd: has joined #RubyOnRails
[06:00:09] gravity_pope: has joined #RubyOnRails
[06:03:08] armyriad: has joined #RubyOnRails
[06:03:27] sidx64: has joined #RubyOnRails
[06:06:02] sidx64: has joined #RubyOnRails
[06:08:43] armyriad: has joined #RubyOnRails
[06:12:03] reber: has joined #RubyOnRails
[06:14:19] andrewray: has joined #RubyOnRails
[06:15:06] andrewray: has joined #RubyOnRails
[06:16:02] andrewray: has joined #RubyOnRails
[06:16:52] andrewray: has joined #RubyOnRails
[06:17:35] andrewray: has joined #RubyOnRails
[06:28:43] mroutis: has joined #RubyOnRails
[06:39:35] srinidhi: has joined #RubyOnRails
[06:48:09] cschneid: has joined #RubyOnRails
[06:57:09] sidx64: has joined #RubyOnRails
[07:04:28] conta: has joined #RubyOnRails
[07:11:34] sidx64_: has joined #RubyOnRails
[07:18:09] sidx64: has joined #RubyOnRails
[07:29:07] mroutis: has joined #RubyOnRails
[07:31:01] sidx64: has joined #RubyOnRails
[07:32:16] nachoman: has joined #RubyOnRails
[07:35:25] KeyJoo: has joined #RubyOnRails
[07:45:53] crst: has joined #RubyOnRails
[07:47:07] crst: Hi, is there something like this for rails? https://github.com/barryvdh/laravel-debugbar
[07:48:08] sevenseacat: https://github.com/dejan/rails_panel might be whaty oure after
[07:48:16] mtkd: has joined #RubyOnRails
[07:51:09] crst: sevenseacat: thanks!
[07:55:11] crst: This is bad, right? Number of executed queries: 575
[07:55:40] dminuoso: crst: N+1? =)
[07:56:18] sevenseacat: yeeees, yes it is
[07:56:39] sevenseacat: do a lot of them look identical? you might have one or more n+1 problems
[07:57:05] alfiemax: has joined #RubyOnRails
[07:57:34] conta1: has joined #RubyOnRails
[07:58:16] crst: no idea what's going on yet. I'm new to this project and my job now is to fix this mess :) Sounds a lot like N+1 indeed, most queries are the same.
[07:58:47] za1b1tsu: has joined #RubyOnRails
[07:59:35] sevenseacat: fun fun. rewarding though!
[07:59:57] dminuoso: apeiros: So.. apparently you cant have an AFTER INSERT trigger on a table `A`, that inserts a record into table `B` using :NEW.id for a foreign key from B to A.
[08:00:15] dminuoso: Oracle refuses to make this work.
[08:00:36] sevenseacat: theresyourproblem.gif
[08:00:42] dminuoso: ACTION pokes sevenseacat with a poking stick
[08:06:34] schneider: has joined #RubyOnRails
[08:24:43] elcms: has joined #RubyOnRails
[08:29:38] schneider: has joined #RubyOnRails
[08:33:50] TomyWork: has joined #RubyOnRails
[08:34:49] TomyWork: http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-validates_uniqueness_of
[08:35:18] TomyWork: does ActiveRecord's validates_uniqueness_of's message parameter allow me to tell the user *which* record has conflicted, somehow?
[08:35:36] dminuoso: TomyWork: Write a custom validatoin.
[08:36:11] dminuoso: TomyWork: Though you could check and see if the `:message` parameter might get the record passed as an argument
[08:36:16] dminuoso: TomyWork: and writing custom validations is super easy.
[08:36:32] TomyWork: yeah but i dont know anything about rails, really...
[08:36:52] dminuoso: "I cant learn Rails because I dont know Rails"
[08:36:54] TomyWork: i just wanted to patch in some more error details to diagnose an error
[08:37:04] dminuoso: TomyWork: I would like you to ponder about that sentence ^- for a while
[08:37:16] TomyWork: i didnt say i cant learn rails
[08:37:21] dminuoso: TomyWork: Again, writing validations is really simple. You dont need to know rails for that.
[08:37:23] TomyWork: other than for time reasons
[08:37:37] dminuoso: TomyWork: http://guides.rubyonrails.org/active_record_validations.html#performing-custom-validations
[08:38:25] sameerynho: has joined #RubyOnRails
[08:39:15] babykosh: has joined #RubyOnRails
[08:43:01] Sylario: has joined #RubyOnRails
[08:43:29] marr: has joined #RubyOnRails
[08:43:55] apeiros: dminuoso: I assume it's only a problem if there's an fk constraint?
[08:46:03] DrYockel: has joined #RubyOnRails
[08:51:41] jottr: has joined #RubyOnRails
[08:51:47] alfiemax: has joined #RubyOnRails
[09:03:22] mikecmpbll: has joined #RubyOnRails
[09:14:01] mtkd: has joined #RubyOnRails
[09:29:18] chridal: How can I use ES6 inside my views in Rails? I'd like to be able to have my files located in the regular views folder, but with Webpacker it seems that I am supposed to put them in app/javascripts?
[09:29:33] chridal: What I'd like to do, is sort of just sprinkle some JS into my already established views
[09:30:00] chridal: If I could do it through a <script>-tag inside my view, like one does in Vue, that would be awesome
[09:32:29] Sylario: chridal > rails is built a lot around unobstrusive JS, by doing so you are going to 'fight' against a lot of rails convention
[09:32:47] chridal: sylario: Please elaborate
[09:33:07] chridal: so, basically, the JS should always be implemented in separate files, and not live inside 'components', sort of?
[09:33:30] Sylario: the integrated JS in rails is named UJS, Unobstrusive JS
[09:34:25] chridal: Alright, so I'll read a bit about that first
[09:36:45] dminuoso: apeiros: Yes.
[09:36:51] Sylario: chridal > rails is a server side framework, you will lose a lot of the advantages of SPA/JS framework. A lot of rails are used with angular/ember/vue.js
[09:37:10] dminuoso: apeiros: I have a feeling its somehow a transactional issue, where the trigger is not executed inside the same transaction
[09:37:23] dminuoso: The thing is, sporadically it seems to work - suggesting this could be a race condition
[09:38:05] dminuoso: So it works if that NEW record is visible from the transaction of the fired trigger
[09:38:09] apeiros: dminuoso: na, triggers always run in the transaction (if you have one)
[09:38:23] apeiros: it's actually annoyingly difficult to emulate something like "after transaction"
[09:38:40] dminuoso: apeiros: Then Im left with no explanation and just confusion.
[09:38:46] workmad3_: has joined #RubyOnRails
[09:38:57] apeiros: I'm not at work, so I can't try :(
[09:39:06] dminuoso: Thats fine, I dont want it to work.
[09:39:12] apeiros: I'm pretty sure our newest application actually does what you describe
[09:39:23] apeiros: but I'm not entirely sure we have fk constraints on those parts
[09:39:37] dminuoso: Every "broken thing" gets added to a big list that hopefully will be the reason to switch away from the most expensive and worst database.
[09:39:56] apeiros: that's the only upside about those bugs :D
[09:42:53] riotjones: has joined #RubyOnRails
[09:46:35] mikecmpb_: has joined #RubyOnRails
[09:55:00] one_zero: has joined #RubyOnRails
[09:57:01] TomyWork: which database would that be? :)
[09:57:16] TomyWork: I have a hunch it starts with an "O"
[10:01:24] KeyJoo: has joined #RubyOnRails
[10:02:33] TomyWork: dminuoso doesnt look to me like the message would be parameterized with the record that failed validation
[10:02:40] dustinm`: has joined #RubyOnRails
[10:02:54] TomyWork: the UniquenessValidator doesn't interact with the message parameter at all
[10:03:11] dminuoso: TomyWork: It has to, since it takes the :message argument somehow
[10:03:32] TomyWork: it just barfs and, i guess, validate_with takes care of the messaging
[10:04:20] halbbalda: Hello there. I am searching for a solution using rails and carrierwave (for Uploads). After a file has been uploaded, I need to submit some data (filename and parameters) to another binary on the machine (for content validation and so on). I think the process call (from my upload controller / carrierwave) would be corresponding way, to run the external validation. What is the best way to run an external
[10:04:22] halbbalda: binary (with parameters) and collect stdout, stderr and the corresponding exit code from rails? Should I use popen3?
[10:10:47] sidx64: has joined #RubyOnRails
[10:24:24] mikecmpbll: has joined #RubyOnRails
[10:25:18] TomyWork: dminuoso i hacked in some metadata at the point where the exception is rescued and written to the log
[10:25:27] TomyWork: so, problem solved :)
[10:29:00] mikecmpbll: has joined #RubyOnRails
[10:45:27] quazimodo: has joined #RubyOnRails
[10:50:25] hfp_work: has joined #RubyOnRails
[10:59:24] dviola: has joined #RubyOnRails
[11:12:35] quazimodo: has joined #RubyOnRails
[11:30:20] nachoman: has joined #RubyOnRails
[11:32:23] Cavallari: has joined #RubyOnRails
[11:42:26] Ryzokuken: has joined #RubyOnRails
[11:44:41] am55: has joined #RubyOnRails
[11:49:57] mr-spoon: has joined #RubyOnRails
[12:05:31] tcopeland: has joined #RubyOnRails
[12:08:28] rfoust: has joined #RubyOnRails
[12:34:53] sidx64: has joined #RubyOnRails
[12:35:13] DrYockel: has joined #RubyOnRails
[12:38:25] DTZUZO: has joined #RubyOnRails
[12:40:47] mtkd: has joined #RubyOnRails
[12:52:09] defsdoor: has joined #RubyOnRails
[13:10:10] blackcross: has joined #RubyOnRails
[13:13:14] cawel: has joined #RubyOnRails
[13:14:58] mikecmpbll: has joined #RubyOnRails
[13:32:35] brycesenz: has joined #RubyOnRails
[13:38:55] brycesenz: has joined #RubyOnRails
[13:42:38] schneider: has joined #RubyOnRails
[13:49:55] kapil___: has joined #RubyOnRails
[14:09:02] samort7: has joined #RubyOnRails
[14:15:22] roshanavand: has joined #RubyOnRails
[14:15:47] tycoon177: i'm having trouble with turbolinks. my understanding is that javascript events do not get unbound between page loads. is this true? if so, how should i handle event handlers? i've been delegating as much as i can to the document, but things like the jquery-ui datepicker and jquery-ui autocomplete are stumping me
[14:16:59] xuyuheng: has joined #RubyOnRails
[14:21:39] schneider: has joined #RubyOnRails
[14:28:16] blackcross: has joined #RubyOnRails
[14:31:23] funnel: has joined #RubyOnRails
[14:39:07] blackcross: has joined #RubyOnRails
[14:40:00] gravity_pope: has joined #RubyOnRails
[14:41:01] kn-928: has joined #RubyOnRails
[14:46:00] mtkd: has joined #RubyOnRails
[15:01:41] cschneid: has joined #RubyOnRails
[15:02:21] rikkipitt: has joined #RubyOnRails
[15:02:57] rikkipitt: hey folks, how do you handle the following efficiently?
[15:03:18] rikkipitt: a normal resource (CRUD) and a version for a parent model?
[15:03:23] rikkipitt: controller-wise
[15:03:41] rikkipitt: 2 controllers or a way of detecting if a parent model id is passed?
[15:12:51] rikkipitt: has joined #RubyOnRails
[15:30:10] schneider: has joined #RubyOnRails
[15:30:50] rikkipitt: has joined #RubyOnRails
[15:32:25] psychoslave: has joined #RubyOnRails
[15:36:53] tycoon177: rikkipitt: i'm not sure what you are meaning. what are you wanting to be returned?
[15:39:38] xuyuheng: has joined #RubyOnRails
[15:40:37] ebsen: has joined #RubyOnRails
[15:42:26] za1b1tsu: has joined #RubyOnRails
[15:47:40] schneider: has joined #RubyOnRails
[15:51:18] cagomez: has joined #RubyOnRails
[15:51:27] drale2k_: has joined #RubyOnRails
[15:54:10] cagomez: consider this snippet: https://hastebin.com/ujuzavejex.rb . In Book, are we saying "respond to .writer by looking scanning the Author model's table for an ID matching book.author_id"?
[15:55:19] rikkipitt: tycoon177: what i mean is, i might have a recipients controller, but i might have a controller that is for adding recipients to a specific project
[15:55:27] iamdevnul_: has joined #RubyOnRails
[15:57:25] tycoon177: rikkipitt: do recipients belong to the project or can they exist independently?
[15:58:13] rikkipitt: tycoon177: they can exist independently as a has_many/through relation to Project
[15:58:40] tycoon177: rikkipitt: okay, so Projects have many recipients through what?
[15:58:49] tycoon177: project_recipients?
[15:59:24] tycoon177: if so, i'd make it another controller, project_recipients. The model would belong_to project and recipient
[15:59:30] KeyJoo: has joined #RubyOnRails
[15:59:43] tycoon177: keep it restful if possible :)
[16:01:19] rikkipitt: tycoon177: yeah that's what i normally do, but just wondered if there was s nice pattern to use for this case
[16:01:36] segy_: has joined #RubyOnRails
[16:01:40] tycoon177: i don't see a problem with it :) but if someone else does, i'd be happy to hear the reasoning
[16:01:53] DTZUZO: has joined #RubyOnRails
[16:03:41] srinidhi: has joined #RubyOnRails
[16:07:35] schneider: has joined #RubyOnRails
[16:07:36] sidx64: has joined #RubyOnRails
[16:08:15] halbbalda: has joined #RubyOnRails
[16:09:27] jcarl43: has joined #RubyOnRails
[16:09:47] rikkipitt: has joined #RubyOnRails
[16:10:19] HalcyonicStorm: has joined #RubyOnRails
[16:10:56] Fenhl: has joined #RubyOnRails
[16:10:57] Lloyd: has joined #RubyOnRails
[16:11:01] auv: has joined #RubyOnRails
[16:12:28] rikkipitt: has joined #RubyOnRails
[16:12:42] mtkd: has joined #RubyOnRails
[16:13:23] xuyuheng: has joined #RubyOnRails
[16:17:25] andrewray: has joined #RubyOnRails
[16:21:05] allcentury: has joined #RubyOnRails
[16:21:16] uksio: has joined #RubyOnRails
[16:22:49] allcentury: I’m having an N+1 issue but when I try and fix it I get back no results. `current_user.posts.includes(:voted)`. user has_many :posts, post belongs_to :voted, polymorphic: true. I get back [] but when I do current_user.posts.flat_map(&:voted) I get back that record correctly. What am I missing?
[16:24:13] Saukk: has joined #RubyOnRails
[16:25:37] syndikate: allcentury, did you try this out in the console and check the SQL queries generated??
[16:26:11] orbyt_: has joined #RubyOnRails
[16:26:12] allcentury: yes, that’s where I’m doing it and if i do `to_sql` at the end of that statement i get back an empty string, “”
[16:26:27] allcentury: @syndikate but if do it without the includes I get back the right sql statement
[16:26:57] syndikate: There could be some conditions on the associations maybe, please run in the console and check the generated sql query
[16:27:01] syndikate: Or share here
[16:27:30] xuyuheng: has joined #RubyOnRails
[16:29:36] allcentury: just figured out the issue, these were in memory before the parent object was saved so there is no query to perform. thanks for the rubber duck syndikate
[16:32:01] rikkipitt: has joined #RubyOnRails
[16:32:15] za1b1tsu: has joined #RubyOnRails
[16:32:57] Ryzokuken: has joined #RubyOnRails
[16:37:06] darkhanb: has joined #RubyOnRails
[16:38:41] DrYockel: has joined #RubyOnRails
[16:40:18] orbyt_: has joined #RubyOnRails
[16:45:08] xuyuheng: has joined #RubyOnRails
[16:58:41] roshanavand: has joined #RubyOnRails
[16:59:25] xuyuheng: has joined #RubyOnRails
[17:14:05] xuyuheng: has joined #RubyOnRails
[17:18:31] dblessing: has joined #RubyOnRails
[17:21:25] srinidhi: has joined #RubyOnRails
[17:22:15] Dimik: has joined #RubyOnRails
[17:23:20] desperek: has joined #RubyOnRails
[17:25:17] kyrylo: has joined #RubyOnRails
[17:26:14] sameerynho: has joined #RubyOnRails
[17:32:10] kyrylo: Hey guys. Let's say I write `ActiveRecord::Base.connection_pool.with_connection { |conn| conn.execute('SET statement_timeout TO "1min"') }`. My question: when we exit `with_connection`, what happens to `conn`? Will it be destroyed, so I don't have to worry about setting statement_timeout to the default value?
[17:33:16] xuyuheng: has joined #RubyOnRails
[17:49:09] workmad3: has joined #RubyOnRails
[17:53:03] dblessing: has joined #RubyOnRails
[17:56:06] xuyuheng: has joined #RubyOnRails
[18:08:58] cstls: has joined #RubyOnRails
[18:12:36] justrying: has joined #RubyOnRails
[18:14:01] cagomez: has joined #RubyOnRails
[18:16:22] xuyuheng: has joined #RubyOnRails
[18:18:33] KeyJoo: has joined #RubyOnRails
[18:25:54] am55: has joined #RubyOnRails
[18:35:42] conceivably: has joined #RubyOnRails
[18:35:43] rfoust: has joined #RubyOnRails
[18:35:49] remix2000: has left #RubyOnRails: ("The Lounge - https://thelounge.github.io")
[18:37:05] xuyuheng: has joined #RubyOnRails
[18:45:14] kyrylo: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[18:57:08] xuyuheng: has joined #RubyOnRails
[19:00:14] mikecmpbll: has joined #RubyOnRails
[19:04:06] dtzuzu: has joined #RubyOnRails
[19:04:42] srinidhi: has joined #RubyOnRails
[19:07:10] cawel: has joined #RubyOnRails
[19:13:48] DTZUZO: has joined #RubyOnRails
[19:16:30] context: has joined #RubyOnRails
[19:16:57] context: anyone have action mailer stop working when upgrading to 5.1 (from 4.2) i have default_url_options[:host] set... but my job says its not set.
[19:17:09] context: whats better is it works in dev, but not prod
[19:17:23] xuyuheng: has joined #RubyOnRails
[19:32:30] xuyuheng: has joined #RubyOnRails
[19:42:24] andrewray: has joined #RubyOnRails
[19:45:14] bronson: has joined #RubyOnRails
[19:46:07] bronson: There's gotta be a better way to use this path helper, right? this works, but ewww...
[19:46:09] bronson: get project_item_path(id: items(:left_pad), project_id: items(:left_pad).project)
[19:46:36] bronson: I would think that project_item_path(items(:left_pad)) would work.
[19:47:13] bronson: actually, let me make that clearer. item = items(:left_pad)
[19:49:40] bronson: project has_many :items
[19:49:52] bronson: doesn't work: project_item_path(item)
[19:50:20] bronson: does work: project_item_path(id: item, project_id: item.project)
[19:50:42] bronson: but that seems kinda silly. is there any way to clean that up?
[19:51:03] dminuoso: bronson: Are there cases when a different project might be passed?
[19:51:27] bronson: no, an item can only ever belong to one project.
[19:51:42] dminuoso: bronson: Why pass project_id at all then? You can infer it from the item object.
[19:52:26] xuyuheng: has joined #RubyOnRails
[19:53:21] bronson: dminuoso: agree! but when I delete that, rails says: ActionController::UrlGenerationError: missing required keys: [:project_id]
[19:53:41] bronson: I don't know why the url generator can't infer it itself.
[19:53:43] dminuoso: bronson: Why dont you show us your routes?
[19:54:00] dminuoso: bronson: No Im suggesting to drop the matter entirely.
[19:55:52] cagomez: has joined #RubyOnRails
[19:57:28] bronson: dminuoso: https://gist.github.com/bronson/12898d711f94c02707af344ace9d1ab6
[19:59:13] cagomez: has joined #RubyOnRails
[19:59:13] dminuoso: bronson: make it a shallow route.
[19:59:16] helpa: Next question, please!
[20:03:53] cagomez: has joined #RubyOnRails
[20:07:32] bronson: dminuoso: yep, that looks like the right solution. thanks.
[20:12:42] xuyuheng: has joined #RubyOnRails
[20:16:21] gravity_pope: has joined #RubyOnRails
[20:19:25] gravity_pope: has joined #RubyOnRails
[20:33:05] xuyuheng: has joined #RubyOnRails
[20:41:02] cagomez: has joined #RubyOnRails
[20:42:09] cagomez: has joined #RubyOnRails
[20:44:01] brycesenz: has joined #RubyOnRails
[20:48:21] cagomez: has joined #RubyOnRails
[20:53:20] xuyuheng: has joined #RubyOnRails
[20:54:19] cagomez: has joined #RubyOnRails
[21:12:53] rikkipitt: has joined #RubyOnRails
[21:13:35] xuyuheng: has joined #RubyOnRails
[21:26:14] workmad3: has joined #RubyOnRails
[21:26:23] xuyuheng: has joined #RubyOnRails
[21:46:37] xuyuheng: has joined #RubyOnRails
[21:56:05] kt: has joined #RubyOnRails
[22:02:49] shpoont: has joined #RubyOnRails
[22:04:45] duper: has joined #RubyOnRails
[22:07:02] xuyuheng: has joined #RubyOnRails
[22:07:55] rikkipitt: has joined #RubyOnRails
[22:07:55] justrying: has joined #RubyOnRails
[22:07:55] auv: has joined #RubyOnRails
[22:07:55] Lloyd: has joined #RubyOnRails
[22:07:55] funnel: has joined #RubyOnRails
[22:07:55] unreal_: has joined #RubyOnRails
[22:07:55] Omnilord: has joined #RubyOnRails
[22:07:55] ghormoon: has joined #RubyOnRails
[22:07:55] jrm: has joined #RubyOnRails
[22:07:55] EXCHGR: has joined #RubyOnRails
[22:07:55] rubemlrm: has joined #RubyOnRails
[22:07:55] Tempesta: has joined #RubyOnRails
[22:07:55] boshhead: has joined #RubyOnRails
[22:07:55] havenwood: has joined #RubyOnRails
[22:07:55] Exagone313: has joined #RubyOnRails
[22:07:55] jcm__: has joined #RubyOnRails
[22:08:47] funnel: has joined #RubyOnRails
[22:09:36] jottr: has joined #RubyOnRails
[22:09:54] Tempesta: has joined #RubyOnRails
[22:10:00] jrm: has joined #RubyOnRails
[22:10:35] auv: has joined #RubyOnRails
[22:11:30] ghormoon: has joined #RubyOnRails
[22:12:11] epochwolf: has joined #RubyOnRails
[22:12:18] trautwein: has joined #RubyOnRails
[22:12:30] mr-spoon: has joined #RubyOnRails
[22:12:31] Exagone313: has joined #RubyOnRails
[22:13:11] ResidentBiscuit: has joined #RubyOnRails
[22:14:28] shpoont: has joined #RubyOnRails
[22:17:32] xuyuheng: has joined #RubyOnRails
[22:18:09] tcopeland: has joined #RubyOnRails
[22:18:43] cawel: has joined #RubyOnRails
[22:23:06] quazimodo: has joined #RubyOnRails
[22:28:36] ResidentBiscuit: has joined #RubyOnRails
[22:30:22] xuyuheng: has joined #RubyOnRails
[22:30:57] mtkd: has joined #RubyOnRails
[22:32:58] Fernando-Basso: has joined #RubyOnRails
[22:43:32] shpoont: has joined #RubyOnRails
[22:50:21] xuyuheng: has joined #RubyOnRails
[22:50:53] SteenJobs: has joined #RubyOnRails
[22:59:37] ResidentBiscuit: has joined #RubyOnRails
[23:00:06] am55: has joined #RubyOnRails
[23:01:22] fcser__: Hmm I’m trying to create some records with a has_one association and they are failing. I’m wondering if my associations should be a has_many or belongs_to… The error when saving: ‘…no such table main.dropoffs’. I would like to have a Route model that has_one :pickup, class_name: ‘Location’ and has_one :dropoff, class_name: ‘Location’ but I must be doing something incorrectly… example:
[23:01:23] fcser__: https://gist.github.com/anonymous/e95db76547bc981e4e65d285320f6f74
[23:02:25] mtkd: has joined #RubyOnRails
[23:10:40] xuyuheng: has joined #RubyOnRails
[23:14:49] rfoust: has joined #RubyOnRails
[23:19:25] gravity_pope: has joined #RubyOnRails
[23:23:42] xuyuheng: has joined #RubyOnRails
[23:25:14] rikkipitt: has joined #RubyOnRails
[23:26:31] workmad3: has joined #RubyOnRails
[23:30:21] brycesenz: has joined #RubyOnRails
[23:35:58] SteenJobs: has joined #RubyOnRails
[23:35:58] Puffball: has joined #RubyOnRails
[23:38:46] brycesenz: has joined #RubyOnRails
[23:44:11] xuyuheng: has joined #RubyOnRails
[23:45:50] fcser__: Ok figured it out - they should be belongs_to and the migration should not have had foreign_key with references
[23:49:31] brycesenz: has joined #RubyOnRails
[23:50:50] ResidentBiscuit: has joined #RubyOnRails
[23:53:55] IRCtoo: has joined #RubyOnRails
[23:56:21] IRCtoo: I'm running Rails 5 in a VirtualBox setup with a sharefolder on a Windows host machine. When I edit a class, say to define a method, I have to restart the rails server for it to take effect. When I edit the controller/method directly from the Virtualbox linux machine running the rails server it reloads it just fine without having to stop and start the server. Any ideas about this. I
[23:56:21] IRCtoo: set this up so that I can develop on the Windows machine and simply have the VirtualBox machine due ot headache of setting up Rails natively in Windows but I can't be making simple changes and then stopping and starting the Rails server every change. :( :( :(