« Back to channel list

#RubyOnRails - 20 March 2019

« Back 1 day Forward 1 day »
[00:03:58] orbyt_: has joined #RubyOnRails
[00:15:30] NeXTSUN: has joined #RubyOnRails
[00:16:51] andywww: has joined #RubyOnRails
[00:24:46] s2013: has joined #RubyOnRails
[01:01:07] kapil____: has joined #RubyOnRails
[01:08:17] sevenseacat: has joined #RubyOnRails
[01:47:03] squonchie: has joined #RubyOnRails
[01:59:35] orbyt_: has joined #RubyOnRails
[02:03:26] lankanmon: has joined #RubyOnRails
[02:08:18] NeXTSUN: has joined #RubyOnRails
[02:22:13] tdy2: has joined #RubyOnRails
[02:35:51] tdy3: has joined #RubyOnRails
[02:40:01] gambl0r3: has joined #RubyOnRails
[02:53:10] dviola: has joined #RubyOnRails
[03:02:00] Saukk: has joined #RubyOnRails
[03:08:48] MrCrackPotBuilde: has joined #RubyOnRails
[03:14:06] NeXTSUN: has joined #RubyOnRails
[03:41:53] mangold: has joined #RubyOnRails
[03:59:49] segy: has joined #RubyOnRails
[04:00:35] bambanx: has joined #RubyOnRails
[04:09:56] braincrash: has joined #RubyOnRails
[04:14:44] srinidhi: has joined #RubyOnRails
[04:17:33] squonchie: has joined #RubyOnRails
[04:41:55] danst: has joined #RubyOnRails
[04:42:33] danst: how do you attach file with rails console? I'm talking about ActiveStorage
[04:43:22] danst: like if you have just binary data
[04:43:31] danst: but it's a picture
[05:05:16] kvda: has joined #RubyOnRails
[05:21:24] pd09041999: has joined #RubyOnRails
[05:24:14] srinidhi: has joined #RubyOnRails
[05:28:23] pd09041999: has joined #RubyOnRails
[05:45:29] dviola: has joined #RubyOnRails
[06:06:54] reber: has joined #RubyOnRails
[06:08:09] reber: has joined #RubyOnRails
[06:23:28] conta: has joined #RubyOnRails
[06:27:08] squonchie: has joined #RubyOnRails
[06:39:07] mangold: has joined #RubyOnRails
[07:01:56] lankanmon: has joined #RubyOnRails
[07:04:32] Dbugger: has joined #RubyOnRails
[07:22:33] hahuang6|: has joined #RubyOnRails
[07:49:47] davK: has joined #RubyOnRails
[08:00:22] squonchie: has joined #RubyOnRails
[08:28:26] Cork: is it possible to do new/build on a has_many through relation and have the middle tables link it set correctly?
[08:36:12] davK: I'm not much experienced but this is an interesting case. What you want to do is a table in between that link two keys of two different tables. So my guess is there is a has_one relation and a has_many relation create the link you want.
[08:40:04] alexeev_: has joined #RubyOnRails
[08:42:04] mangold: has joined #RubyOnRails
[08:42:44] Cork: davK: its a has_many and a belongs_to but ya
[08:43:26] Cork: the problem is if i created it from that direction i will have to use nested resource for the belongs_to and that becomes incompatible with the call i have today
[08:47:05] hightower2: has joined #RubyOnRails
[08:47:24] Cork: i can get everything working but i seam to have to override the initialize method to set the relation id correctly...
[08:47:35] Cork: thoughy i don't have a clue where that happens normalt >_<
[08:53:30] segy: has joined #RubyOnRails
[09:00:59] GodFather: has joined #RubyOnRails
[09:17:54] neozor: has joined #RubyOnRails
[09:23:20] mikecmpbll: has joined #RubyOnRails
[09:37:18] MrCrackPotBuilde: has joined #RubyOnRails
[09:45:37] Ergo: has joined #RubyOnRails
[09:53:02] deathwishdave: has joined #RubyOnRails
[09:54:54] guyzmo: hi! I have a many to many association: `class A -> class AB -> class B`, I wrote a method that given an `A` instance, I can build a new `AB` (there are several checks, and calculations I need to do at build time), then I save `A`, I save the `AB`s instances, but I need to reload all associations of `A` to get the new `AB`s and `B`s accessible… I there a way to reset all associations of an instance
[09:54:56] guyzmo: without listing them explicitely?
[09:55:29] guyzmo: or without rebuilding the instance (I could do `A.find(a.id)`)
[09:56:25] guyzmo: because in `A`, I got a lot of `has_many`, `has_many .. through` to get ABs, Bs, some with order, some with filters etc.
[09:56:45] gregf_: has joined #RubyOnRails
[09:57:07] guyzmo: (and I also got some `has_one`s that are dependent on the `has_many`s)
[09:58:22] guyzmo: I'm crawling through the RTFM, and I found `reset`, `reload` on each association, I can get all associations on the class using reflect methods, but I don't find how I can get all associations of an instance to call reset on it, or call some reset on the instance itself
[10:04:56] guyzmo: so to end with a question mark: is there a way to reset all the association caches of an instance?
[10:05:09] guyzmo: of an activerecord model instance*
[10:06:32] Cork: guyzmo: you do have self.class.reflect_on_all_associations
[10:06:41] Cork: it might give you what you want
[10:07:58] conta: has joined #RubyOnRails
[10:11:36] guyzmo: yup, that's what I'm trying to use
[10:14:21] ebbflowgo: has joined #RubyOnRails
[10:15:53] guyzmo: something like : A.reflect_on_all_associations.map(&:name).each { |assoc| self.send(assoc)&.reset }
[10:16:37] Cork: public_send(assoc).reset should work
[10:17:02] Cork: you might want a check if self.public_send(alloc).blank?
[10:17:15] Cork: (so you don't try it on an association that doens't exist)
[10:18:13] guyzmo: though, I need to call reset_assoc on has_ones
[10:18:58] guyzmo: and I don't find a method on association that easily checks whether this is a has_many or a has_one
[10:20:57] guyzmo: (befond checking the association class)
[10:21:16] Cork: has_ones = server.class.reflect_on_all_associations(:has_one).select {|association| !association.through_reflection? }.map(&:name)
[10:21:33] Cork: opps s/server/self/
[10:21:55] Cork: i've actually needed the exact same thing so :)
[10:22:01] Cork: well not for reset but...
[10:25:02] dionysus69: has joined #RubyOnRails
[10:25:38] guyzmo: actually I need to reset the through as well :)
[10:27:06] guyzmo: hm… I thought I've read somewhere it was `reset_#{has_one_assoc}`… but that does not work
[10:30:53] guyzmo: ah there's only reload_
[10:32:51] lankanmon: has joined #RubyOnRails
[10:54:53] mangold: has joined #RubyOnRails
[10:58:01] mangold: has joined #RubyOnRails
[11:09:08] conta: has joined #RubyOnRails
[11:53:57] nakuku: has joined #RubyOnRails
[11:54:40] nakuku: Hello. If a user is NOT permitted to add a post with attribute (global: true) then is this validation or authorization error?
[11:55:37] nakuku: errors: { global: ['unpermitted state'] }. Returning validation error like this makes sense?
[11:56:38] nakuku: The proper way of handling this would be i think creating a new route. So i would have `posts/` and `global_posts/` so then it would for sure be easier. But what do you think about first approach?
[11:57:47] nakuku: Because validations can differ depending on context, so i think that it's fine to return it as validation error.
[12:07:04] alexeev: has joined #RubyOnRails
[12:15:12] nakuku: has joined #RubyOnRails
[12:35:01] alexeev: has joined #RubyOnRails
[12:44:29] alexeev: has joined #RubyOnRails
[12:51:31] dviola: has joined #RubyOnRails
[13:47:40] alexeev: has joined #RubyOnRails
[14:00:52] deathwishdave: has joined #RubyOnRails
[14:01:20] segy: has joined #RubyOnRails
[14:05:07] dviola: has joined #RubyOnRails
[14:08:36] mangold: has joined #RubyOnRails
[14:23:02] reber: has joined #RubyOnRails
[14:24:24] conta: has joined #RubyOnRails
[14:26:22] morantron: has joined #RubyOnRails
[14:27:26] morantron: hi! is it possible to use model fixtures in mailer previews?
[14:31:43] dviola: has joined #RubyOnRails
[14:39:51] cxl: Are gemset worth the trouble with Ruby on Rails? I'm having issues with a number of Guard plugins that aren't gemset aware and don't work as expected. Do you use gemsets at all for Rails projects?
[14:49:06] context: has joined #RubyOnRails
[14:49:42] context: so i have vuetify in my package.json and sprockets is compiling an "application.js" within it. i didnt think sprockets looked at package.json but more importantly, how do i tell it to ignore it
[14:50:56] context: actually whats even better is this asset doesnt exist where it said it was produced... thats sweet
[14:53:05] context: has joined #RubyOnRails
[14:53:19] context: i cant get off sprockets quick enough
[14:53:34] context: i should just compile these never changing assets and commit them
[14:54:37] mangold: has joined #RubyOnRails
[15:05:09] hightower2: has joined #RubyOnRails
[15:25:13] rascencio: has joined #RubyOnRails
[15:36:44] zer0python: has joined #RubyOnRails
[15:36:51] zer0python: I'm trying to use the gon gem in rails, and it keeps coming up undefined, I've tried gon.fromname = "name", in my action controller, but the javascript comes up undefined. Does anyone have experience with this?
[15:37:28] zer0python: I've tried using gon.push({ fromname: "name" }) as well
[15:37:49] za1b1tsu: has joined #RubyOnRails
[15:39:15] dviola: has joined #RubyOnRails
[15:50:37] neozor: has joined #RubyOnRails
[16:03:24] guyzmo: @nakuku - I'd vote for authorization error, but what really matters is what feedback you give to your users
[16:03:30] deathwishdave: has joined #RubyOnRails
[16:06:53] dviola: has joined #RubyOnRails
[16:07:09] orbyt_: has joined #RubyOnRails
[16:18:48] Dbugger: has joined #RubyOnRails
[16:21:33] nakuku: guyzmo: Thanks! I will return { moossage: "Something happened" } :D
[16:21:49] nakuku: With random HTTP status!
[16:21:54] nakuku: That will show them!
[16:26:28] nakuku: But yeah, authorization error sound good.
[16:56:56] za1b1tsu: has joined #RubyOnRails
[16:58:27] [Butch]: has joined #RubyOnRails
[17:01:08] Saukk: has joined #RubyOnRails
[17:11:51] FLeiXiuS: has joined #RubyOnRails
[17:20:15] gambl0r3: has joined #RubyOnRails
[17:20:35] chemic: has joined #RubyOnRails
[17:20:49] neozor: has joined #RubyOnRails
[17:21:36] chemic: Hey guys! Setting up a brand new project on Rails 6.0beta3 and wondering what authentication solution should I use these days? Sadly well known Devise is not 6.0 ready yet :(
[17:22:11] chemic: I’m looking for omniauth type of solution for email+password and google/facebook
[17:23:04] deathwishdave: has joined #RubyOnRails
[17:33:34] jottr: has joined #RubyOnRails
[17:38:01] deathwishdave: has joined #RubyOnRails
[17:57:40] hightower2: has joined #RubyOnRails
[18:05:01] Tempesta: has joined #RubyOnRails
[18:13:06] ravenous_: has joined #RubyOnRails
[18:20:57] deathwishdave: has joined #RubyOnRails
[18:25:10] defsdoor_: has joined #RubyOnRails
[18:27:31] orbyt_: has joined #RubyOnRails
[18:28:39] hnanon: has joined #RubyOnRails
[18:31:24] ferdi2005: has joined #RubyOnRails
[18:34:19] G: has joined #RubyOnRails
[18:34:40] DukeDave: has joined #RubyOnRails
[18:34:45] mikecmpbll: has joined #RubyOnRails
[18:34:51] jhill: has joined #RubyOnRails
[18:39:24] arielserafini: has joined #RubyOnRails
[18:40:56] Fire-Dragon-DoL: has joined #RubyOnRails
[18:44:01] za1b1tsu: has joined #RubyOnRails
[18:48:10] hnanon: has joined #RubyOnRails
[19:07:05] kapil____: has joined #RubyOnRails
[19:10:03] uks: has joined #RubyOnRails
[19:10:03] uksio: has joined #RubyOnRails
[19:52:53] hnanon_: has joined #RubyOnRails
[19:56:53] Fridtjof: has joined #RubyOnRails
[19:58:31] hnanon: has joined #RubyOnRails
[20:01:06] beanHolez: has joined #RubyOnRails
[20:03:32] beanHolez: I have a rails model to which I want to pass some arguments every time it's initialized. What is the proper way to do this? My first though it to use a class method that initializes an instance and sets an instance variable, but I'm not certain if that's the right approach
[20:05:02] rascencio: has joined #RubyOnRails
[20:13:32] ur5us: has joined #RubyOnRails
[20:15:21] hahuang65_: has joined #RubyOnRails
[20:20:10] hnanon_: has joined #RubyOnRails
[20:23:39] hahuang65: has joined #RubyOnRails
[20:45:56] beholders_eye: has joined #RubyOnRails
[20:47:35] mikecmpbll: has joined #RubyOnRails
[21:28:16] deathwishdave: has joined #RubyOnRails
[21:35:24] ivanskie: has joined #RubyOnRails
[21:47:57] xco: has joined #RubyOnRails
[22:03:24] zer0python: is there a reason I can't use global variables in rails 5.2.2.1 in a js response to remote: true
[22:04:23] zer0python: @foo = "foo" ; respond_to { |format| format.js } ; # alert('<%= @foo -%>'); // yields an empty string
[22:04:33] zer0python: when I would expect foo
[22:08:12] bambanx: has joined #RubyOnRails
[22:21:09] zer0python: I have a form that I'm using remote: true
[22:21:24] zer0python: and I want to prepend a table
[22:23:39] duderonomy: has joined #RubyOnRails
[22:35:45] NeXTSUN: has joined #RubyOnRails
[22:38:21] NeXTSUN: has joined #RubyOnRails
[22:42:11] dviola: has joined #RubyOnRails
[22:50:59] gambl0r3: has joined #RubyOnRails
[23:06:31] kvda: has joined #RubyOnRails
[23:26:16] bambanx: has left #RubyOnRails: ("Leaving")
[23:32:26] xco: has joined #RubyOnRails