« Back to channel list

#RubyOnRails - 28 January 2019

« Back 1 day Forward 1 day »
[00:10:49] lexileo: has joined #RubyOnRails
[00:35:23] uplime: has joined #RubyOnRails
[00:48:42] uplime: has joined #RubyOnRails
[01:49:15] JanMrlth: has joined #RubyOnRails
[01:52:20] lankanmon: has joined #RubyOnRails
[01:57:57] tdy: has joined #RubyOnRails
[02:06:34] cschneid: has joined #RubyOnRails
[02:38:45] tdy: has joined #RubyOnRails
[02:43:11] Saukk: has joined #RubyOnRails
[02:47:53] Jervis_: has joined #RubyOnRails
[02:48:25] mr-spoon: has joined #RubyOnRails
[02:50:43] tdy: has joined #RubyOnRails
[03:03:58] tdy: has joined #RubyOnRails
[03:13:22] cschneid: has joined #RubyOnRails
[03:17:01] duderonomy: has joined #RubyOnRails
[03:30:41] eckhardt: has joined #RubyOnRails
[03:37:56] brandoncc: has joined #RubyOnRails
[03:47:42] lankanmon: has joined #RubyOnRails
[03:50:32] cschneid: has joined #RubyOnRails
[03:57:53] cschneid: has joined #RubyOnRails
[04:03:57] cschneid: has joined #RubyOnRails
[04:09:34] braincrash: has joined #RubyOnRails
[04:35:14] tdy: has joined #RubyOnRails
[04:46:16] srinidhi: has joined #RubyOnRails
[04:57:55] Xiti: has joined #RubyOnRails
[05:05:11] srinidhi: has joined #RubyOnRails
[05:21:39] brandoncc: has joined #RubyOnRails
[05:25:12] mr_roybot: has joined #RubyOnRails
[05:26:30] gambl0r3: has joined #RubyOnRails
[05:46:32] Technodrome: has joined #RubyOnRails
[06:04:34] srinidhi: has joined #RubyOnRails
[06:16:59] tdy: has joined #RubyOnRails
[06:17:51] tdy: has joined #RubyOnRails
[06:19:35] segy: has joined #RubyOnRails
[06:26:24] reber: has joined #RubyOnRails
[06:34:36] conta: has joined #RubyOnRails
[07:35:04] dionysus69: are there tools to profile memory usage of rails inside redis? I have 250mb redis instance and it is always full, I wonder which cache objects occupy largest space so I expire them accordingly, most likely they are stale
[07:36:57] gambl0r3: has joined #RubyOnRails
[08:00:16] defsdoor: has joined #RubyOnRails
[08:04:27] mikecmpbll: has joined #RubyOnRails
[08:09:54] blackmesa: has joined #RubyOnRails
[08:14:15] lankanmon: has joined #RubyOnRails
[08:25:18] blackmesa: has joined #RubyOnRails
[08:38:35] Dbugger: has joined #RubyOnRails
[08:38:50] Dbugger: has joined #RubyOnRails
[09:06:09] mikecmpbll: has joined #RubyOnRails
[09:24:07] Ergo: has joined #RubyOnRails
[09:46:17] xhoy: dionysus69: https://redis.io/commands/memory-usage
[09:46:38] xhoy: dionysus69: https://redis.io/commands/memory-stats
[09:51:39] GodFather: has joined #RubyOnRails
[10:04:48] za1b1tsu: has joined #RubyOnRails
[10:26:53] defsdoor: has joined #RubyOnRails
[10:29:36] jlebrech: has joined #RubyOnRails
[10:35:39] alexterziev: has joined #RubyOnRails
[10:36:16] dionysus69: xhoy: thanks I'll go with memory-usage, I knew about memory-stats which doesnt give me info I need
[10:37:23] alexterziev: Hi, I have an issue with ActionMailer, after updating Rails to version 5.2 I receive the following error: https://dpaste.de/dwVe
[10:38:30] bruce_lee: has joined #RubyOnRails
[10:39:14] pavelz: is there a way to get ActiveRecord relation on union
[10:39:37] pavelz: like Job.where().union(Job.where()) ?
[10:40:03] mikecmpbll: pavelz : nope
[10:42:19] mikecmpbll: what's the use case for union, above OR?
[10:42:42] mikecmpbll: Job.where(a: 1).union(Job.where(b: 2)) === Job.where(a:1).or(Job.where(b:2) ?
[10:44:24] defsdoor: has joined #RubyOnRails
[10:44:29] pavelz: Job.where("group_id is null").union(Job.where("group_id is not null or in (3,11)))
[10:44:56] mikecmpbll: you can do that with .or()
[10:45:00] pavelz: one gets all null values and other one selects some of the group values
[10:45:06] pavelz: so or can't go in here
[10:45:30] pavelz: oh right i got rid of that group by statement
[10:46:00] mikecmpbll: tbh that query is weird because you're selecting null, and not null. so that's every value.
[10:47:01] mikecmpbll: "group_id is not null or in (3,11)" is illogical too, as 3/11 value is not null
[10:51:57] defsdoor: has joined #RubyOnRails
[10:57:23] ldnunes: has joined #RubyOnRails
[11:06:10] lxsameer: has joined #RubyOnRails
[11:10:37] conta: has joined #RubyOnRails
[11:15:56] Guest16678: has joined #RubyOnRails
[11:20:44] conta: has joined #RubyOnRails
[11:28:33] kidPalooma: has joined #RubyOnRails
[11:29:49] kidPalooma: hello, I'm getting this error when deploying https://hastebin.com/awodarinel.coffeescript
[11:30:57] kidPalooma: I have updated gems because I had a conflict in my Gemfile.lock
[11:31:09] kidPalooma: activesupport has been updated as well
[11:41:00] srinidhi: has joined #RubyOnRails
[11:49:01] kidPalooma: it seems to be working now. I have downgraded Rails from 5.2.2 to 5.2.1 and webpacker from 4.0.0.rc.7 to 4.0.0.pre.3
[11:49:11] kidPalooma: it was an auto-update
[11:55:27] ariedler: has joined #RubyOnRails
[12:02:40] hadifarnoud: has joined #RubyOnRails
[12:12:30] hadifarnoud: has joined #RubyOnRails
[12:16:11] lankanmon: has joined #RubyOnRails
[12:20:51] calaveraDeluxe08: has joined #RubyOnRails
[12:29:34] Leifr: has joined #RubyOnRails
[12:38:47] calaveraDeluxe08: I got some behaviour I can't explain regarding params. When I do an ajax update with the parameters {name: 'foo', color: 'red'} against a route defined with 'resources :cars' (say /cars/1), the params end up on the controller like this: '{name: "foo", color: "red", id: 1, car: {name: "foo", color: "red"}}'. I'm a bit irritated as to where that 'car' hash is coming from, and how it knows which keys to put into it (when I
[12:39:07] calaveraDeluxe08: to attributes on the Car model, they do not appear in the 'car' hash). Can someone point me to some documentation about this feature? Google finds nothing for me.
[12:41:52] jhass: calaveraDeluxe08: https://guides.rubyonrails.org/action_controller_overview.html#json-parameters "wrap_parameters"
[12:45:39] jhass: this made more sense in the attr_accessible days I guess, so you could just MyModel.update params[:foo], nowadays with strong parameters you'd list the valid ones in the controller anyway so I don't see much point in it anymore tbh
[12:49:45] calaveraDeluxe08: yeah, I don't see the point either. It also leads to 'unpermitted_parameters' warnings, because the key are copied. I think i'm going to disable it.
[13:12:45] Linuus`: has joined #RubyOnRails
[13:19:03] dviola: has joined #RubyOnRails
[13:37:54] blackmesa: has joined #RubyOnRails
[13:41:04] blackmesa1: has joined #RubyOnRails
[13:43:02] mr_roybot: has joined #RubyOnRails
[13:54:54] timwis: has joined #RubyOnRails
[13:56:34] timwis: 👋hi everyone. i'm trying to use a rather complex SQL query in rails. It uses a recursive common table expression (CTE). i'm new to rails so not sure the best way to do this. should i be looking for "arel" documentation? it seems like that's been folded into activerecord.
[13:56:35] timwis: the query: https://www.db-fiddle.com/f/A1ZUjrWKqWzAeU9vVeaPG/3
[14:04:04] jhass: Tbh probably just https://api.rubyonrails.org/classes/ActiveRecord/Querying.html#method-i-find_by_sql
[14:05:01] jhass: it kinda forgoes the DB abstraction but for a couple of special queries per project that's usually handable
[14:05:28] jhass: just make it a nice helper in the model or some module somewhere, don't stuff it wherever you need it
[14:05:42] timwis: jhass: hm.. i found a few articles that showed how you can use Arel or Sequel to do it quite elegantly. Are those not recommended?
[14:06:02] jhass: arel for CTEs? haven't seen that before
[14:06:15] timwis: https://www.monterail.com/blog/rails-active-record-arel-sequel
[14:06:47] jhass: I'd say it's a it depends, the abstraction may make it more opaque for these advanced things and you then have to know both well, the abstraction and the thing it tries to abstract
[14:06:48] timwis: although arel's not very readable there :/
[14:06:54] timwis: yeah okay fair
[14:07:03] timwis: so long as i'm not losing out on any optimisations or something
[14:07:10] timwis: or chainability
[14:07:20] timwis: i guess i would be losing chainability
[14:07:26] timwis: but probably worth the readability
[14:07:56] jhass: basically here I would say do what your team is more comfortable with
[14:08:34] timwis: it would be nice if i could use part SQL, part activerecord. so i can leverage the models and scopes
[14:08:55] timwis: like you can do with a WHERE clause, .where("SQL HERE", param, param)
[14:09:38] jhass: I guess that's actually somehow possible with arel but I never tried. And also not sure I agree, you kinda loose the benefits of either (portability on the one hand and one less thing to understand on the other)
[14:09:57] jhass: to answer your question I guess arel's docs would be https://www.rubydoc.info/gems/arel, but granted they're not awesome
[14:12:04] timwis: interesting. yeah it's got a CTE example on that homepage. thanks
[14:13:21] conta: has joined #RubyOnRails
[14:29:37] alan_w: has joined #RubyOnRails
[14:30:28] Linuus`: has joined #RubyOnRails
[14:40:33] greengriminal: has joined #RubyOnRails
[14:48:53] lexileo: has joined #RubyOnRails
[15:22:00] kapil____: has joined #RubyOnRails
[15:33:59] squaresurf: has joined #RubyOnRails
[15:48:11] Saukk: has joined #RubyOnRails
[15:48:55] tdy: has joined #RubyOnRails
[15:55:53] lxsameer: has joined #RubyOnRails
[15:58:02] Linuus`: has joined #RubyOnRails
[16:02:08] jamiew: has joined #RubyOnRails
[16:10:23] srinidhi: has joined #RubyOnRails
[16:23:49] gregf_: has joined #RubyOnRails
[16:24:23] Dbugger: has joined #RubyOnRails
[16:42:48] maryo: has joined #RubyOnRails
[16:49:26] maryo: I have a open call for reading a file, something like this https://dpaste.de/kMWZ does it really need a close call too?
[16:56:40] orbyt_: has joined #RubyOnRails
[16:57:13] darris: has joined #RubyOnRails
[17:10:04] orbyt_: has joined #RubyOnRails
[17:23:15] bruce_lee: has joined #RubyOnRails
[17:30:52] Saukk: has joined #RubyOnRails
[17:32:16] srinidhi: has joined #RubyOnRails
[17:38:08] tdy: has joined #RubyOnRails
[17:47:59] Net: reload! doesn't seem to run lines placed after a class definition, is there something I can do about this?
[17:56:37] gambl0r3: has joined #RubyOnRails
[18:01:12] Terens: has joined #RubyOnRails
[18:02:58] Terens: I have an argument of what is better. More experienced developer loads all AR objects like Contact.all.inject({}) { |_, v| _.merge!(v.id => { firstname: v.firstname, lastname: v.lastname, account_id: v.account_id, time_zone: v.time_zone})
[18:03:27] Terens: and then lookups with contacts.select{ |k, v| v[:email] == row_email }
[18:03:33] Terens: for each row..
[18:03:44] Terens: is this more effient than querying the database?
[18:05:09] brandoncc: has joined #RubyOnRails
[18:21:26] grvgr: has joined #RubyOnRails
[18:26:56] Linuus`: has joined #RubyOnRails
[18:27:24] tdy: has joined #RubyOnRails
[18:31:26] havenwood: terens: That doesn't sound efficient at all. Check the memory and time that it takes. Have you considered #where with #pluck?
[18:33:21] havenwood: terens: An aside, but use ::find_each instead of ::all, to load batches of 1000 when you're going to use an Enumerable method.
[18:36:54] conta: has joined #RubyOnRails
[18:36:59] s2013: has joined #RubyOnRails
[18:47:04] bga57: has joined #RubyOnRails
[19:01:45] ravenousmoose: has joined #RubyOnRails
[19:03:37] Technodrome: has joined #RubyOnRails
[19:04:13] mr-spoon: has joined #RubyOnRails
[19:12:33] cnsvc: has joined #RubyOnRails
[19:18:20] srinidhi: has joined #RubyOnRails
[19:20:21] catbusters: has joined #RubyOnRails
[19:33:00] s2013: has joined #RubyOnRails
[19:33:44] agent_white: has joined #RubyOnRails
[19:37:54] blackcross: has joined #RubyOnRails
[19:44:43] Terens: he wants to load all as a hash ine memory in order to avoid lookups
[19:44:58] Terens: it works though faster
[20:00:21] krawchyk: has joined #RubyOnRails
[20:08:14] cnsvc: has joined #RubyOnRails
[20:17:14] ravenousmoose: has joined #RubyOnRails
[20:30:54] tdy: has joined #RubyOnRails
[20:32:13] s2013: has joined #RubyOnRails
[20:40:05] ravenousmoose: has joined #RubyOnRails
[20:56:45] _aeris_: has joined #RubyOnRails
[20:56:55] Linuus`: has joined #RubyOnRails
[20:59:30] sagax: has joined #RubyOnRails
[21:24:24] duderonomy: has joined #RubyOnRails
[21:27:33] Xiti: has joined #RubyOnRails
[21:28:34] conta: has joined #RubyOnRails
[21:34:51] conta: has joined #RubyOnRails
[21:38:24] roshanavand: has joined #RubyOnRails
[21:47:45] cnsvc: has joined #RubyOnRails
[21:55:44] GodFather: has joined #RubyOnRails
[22:21:07] quazimodo: has joined #RubyOnRails
[22:25:41] greengriminal: has joined #RubyOnRails
[22:46:43] Technodrome: has joined #RubyOnRails
[23:03:25] hightower2: has joined #RubyOnRails
[23:04:24] hightower2: Hey, I have a form_for with some text fields. I'd like e.g. field :name to be pre-populated with @user.name. What option/syntax do I use for this inside of: <%= user_form.text_field :name, :id => 'user_name' %>
[23:06:11] tlewin: has joined #RubyOnRails
[23:21:07] tlewin: has left #RubyOnRails: ()
[23:23:00] ltd: has joined #RubyOnRails
[23:24:09] ltd: has joined #RubyOnRails
[23:26:38] DTZUZO_: has joined #RubyOnRails
[23:52:15] tdy: has joined #RubyOnRails
[23:54:51] hightower2: I use ActiveAdmin and I'd like a custom button to do a cascading delete on an object. What parameter or method do I use for that (as opposed to just trying to delete the main record and receiving an error about existing foreign keys)