« Back to channel list

#RubyOnRails - 28 March 2018

« Back 1 day Forward 1 day »
[00:03:46] cagomez: has joined #RubyOnRails
[00:16:40] jottr: has joined #RubyOnRails
[00:26:49] orbyt_: has joined #RubyOnRails
[00:30:31] jottr: has joined #RubyOnRails
[00:45:05] jottr: has joined #RubyOnRails
[00:48:44] Radar: thomasfedb: Can you make the fragment cache hash a combination of user_id and badge.updated_at ?
[00:48:57] Radar: Or even, badges.max(:updated_at)
[00:59:07] jottr: has joined #RubyOnRails
[01:04:33] duderonomy: has joined #RubyOnRails
[01:05:33] jottr: has joined #RubyOnRails
[01:07:10] tdy: has joined #RubyOnRails
[01:07:41] tdy: has joined #RubyOnRails
[01:11:45] jottr: has joined #RubyOnRails
[01:18:53] dnewkerk: has joined #RubyOnRails
[01:20:42] beingjohnm: has joined #RubyOnRails
[01:20:53] jottr: has joined #RubyOnRails
[01:21:31] xpl0iter: has joined #RubyOnRails
[01:35:26] jottr: has joined #RubyOnRails
[01:41:30] Cache_Money: has joined #RubyOnRails
[01:46:27] cagomez: has joined #RubyOnRails
[01:48:18] jottr: has joined #RubyOnRails
[01:54:31] thomasfedb: Radar: that might be the way to do it. Suns kinda yucky though
[01:55:25] thomasfedb: Not sure it will play nice with collection caching either.
[01:56:36] cagomez: has joined #RubyOnRails
[02:02:17] jottr: has joined #RubyOnRails
[02:11:19] harrycs: has joined #RubyOnRails
[02:12:06] ebsen: has joined #RubyOnRails
[02:12:54] harryv: has joined #RubyOnRails
[02:15:59] jottr: has joined #RubyOnRails
[02:18:36] codetrane: has joined #RubyOnRails
[02:22:41] ebsen: has joined #RubyOnRails
[02:24:15] Dimik: has joined #RubyOnRails
[02:28:20] harryv: has joined #RubyOnRails
[02:29:56] harryv: has joined #RubyOnRails
[02:31:15] jottr: has joined #RubyOnRails
[02:31:58] harryv: has joined #RubyOnRails
[02:32:29] ebsen: has joined #RubyOnRails
[02:36:48] jottr: has joined #RubyOnRails
[02:37:54] harryv: has joined #RubyOnRails
[02:43:45] ebsen: has joined #RubyOnRails
[02:44:12] jottr: has joined #RubyOnRails
[02:47:55] harryv: has joined #RubyOnRails
[02:51:54] harryv: has joined #RubyOnRails
[02:52:23] darkhanb: has joined #RubyOnRails
[02:54:37] jottr: has joined #RubyOnRails
[02:55:52] Tempesta: has joined #RubyOnRails
[03:00:32] ur5us: has joined #RubyOnRails
[03:04:38] jottr: has joined #RubyOnRails
[03:10:37] Saukk: has joined #RubyOnRails
[03:18:21] jottr: has joined #RubyOnRails
[03:24:16] jottr: has joined #RubyOnRails
[03:27:52] cagomez: has joined #RubyOnRails
[03:34:26] jottr: has joined #RubyOnRails
[03:44:01] jottr: has joined #RubyOnRails
[03:50:51] jottr: has joined #RubyOnRails
[04:05:58] elcms: has joined #RubyOnRails
[04:06:38] jottr: has joined #RubyOnRails
[04:11:03] cagomez: has joined #RubyOnRails
[04:15:29] jottr: has joined #RubyOnRails
[04:16:43] ur5us: has joined #RubyOnRails
[04:25:14] trautwein: has joined #RubyOnRails
[04:31:05] jottr: has joined #RubyOnRails
[04:37:26] jottr: has joined #RubyOnRails
[04:49:45] jottr: has joined #RubyOnRails
[04:52:29] dionysus69: has joined #RubyOnRails
[04:56:04] spohnz_: has joined #RubyOnRails
[05:02:08] KeyJoo: has joined #RubyOnRails
[05:03:00] KeyJoo: has joined #RubyOnRails
[05:03:37] jottr: has joined #RubyOnRails
[05:16:30] jottr: has joined #RubyOnRails
[05:23:45] jottr: has joined #RubyOnRails
[05:23:48] planigan: has joined #RubyOnRails
[05:30:42] reber: has joined #RubyOnRails
[05:39:15] jottr: has joined #RubyOnRails
[05:47:07] jottr: has joined #RubyOnRails
[05:55:43] jottr: has joined #RubyOnRails
[06:01:56] jottr: has joined #RubyOnRails
[06:11:14] jottr: has joined #RubyOnRails
[06:15:13] arathald: has joined #RubyOnRails
[06:15:27] argoneus: has joined #RubyOnRails
[06:20:02] ur5us: has joined #RubyOnRails
[06:22:31] jottr: has joined #RubyOnRails
[06:35:58] jottr: has joined #RubyOnRails
[06:37:30] dionysus69: has joined #RubyOnRails
[06:45:40] jottr: has joined #RubyOnRails
[06:50:14] za1b1tsu: has joined #RubyOnRails
[06:53:58] conta: has joined #RubyOnRails
[07:14:38] kapil___: has joined #RubyOnRails
[07:16:53] pavelz: has joined #RubyOnRails
[07:17:43] pavelz: i wonder where can I get .to_xml functionality ? AR objects do not seem to have it and respond_to just wraps pointers to objects.
[07:18:14] pavelz: to rephrase. i want to_json but for to_xml
[07:21:15] mices: has joined #RubyOnRails
[07:21:44] mices: how do i have rails perform an action at a scheduled time (auctions end)
[07:24:03] pavelz: activejob or via a hook?
[07:24:43] havenwood: pavelz: You'll probably want to use an xml serializer gem for ar, but you *could* just: JSON.parse(record.to_json).to_xml root: record.class.name.downcase
[07:26:06] pavelz: hah tru dat
[07:29:04] havenwood: record.class.name.underscore **
[07:30:15] havenwood: pavelz: This is the serializer that was removed from Rails: https://github.com/rails/activemodel-serializers-xml
[07:30:23] havenwood: pavelz: Just add it back since you're using it.
[07:30:25] timdotrb: has joined #RubyOnRails
[07:31:30] pavelz: havenwood: already installed thx!
[07:31:47] uks: has joined #RubyOnRails
[07:37:09] schneider: has joined #RubyOnRails
[07:44:21] elcms: has joined #RubyOnRails
[07:47:21] ur5us: has joined #RubyOnRails
[07:52:08] shpoont: has joined #RubyOnRails
[07:58:44] chartractegg: has joined #RubyOnRails
[08:02:07] Sylario: has joined #RubyOnRails
[08:18:30] marr: has joined #RubyOnRails
[08:20:22] roshanavand: has joined #RubyOnRails
[08:30:55] MrCrackPotBuilde: a lot of tutorials explain how to build an api but the tutorials around for using api's and then displaying the json data in html form are lacking anyone know any good ones
[08:35:42] riotjones: has joined #RubyOnRails
[08:46:06] riotjones: has joined #RubyOnRails
[08:47:46] rshetty: has joined #RubyOnRails
[08:50:48] defsdoor: has joined #RubyOnRails
[09:01:19] Ryzokuken: has joined #RubyOnRails
[09:23:29] mjolnird: has joined #RubyOnRails
[09:25:48] jottr: has joined #RubyOnRails
[09:25:59] tpendragon: has joined #RubyOnRails
[09:29:02] riotjones: has joined #RubyOnRails
[09:30:26] srinidhi: has joined #RubyOnRails
[10:10:21] riotjones: has joined #RubyOnRails
[10:18:12] rikkipitt: has joined #RubyOnRails
[10:29:24] lunarkitty7: has joined #RubyOnRails
[10:33:03] Torrone: has joined #RubyOnRails
[10:35:51] Torrone: hello, I have a user model that has a paperclip attachment, I use paperclip avatar.url(size) to get it, the user model also has a field called image_url that contains an external image url. I want to override the avatar.url method for the user model so that I can get the image_url field if no attachment is present. Do you think that's possibile without changing all the method calls with another method name?
[10:41:38] timdotrb: has joined #RubyOnRails
[10:42:35] timdotrb: has joined #RubyOnRails
[10:43:18] timdotrb: has joined #RubyOnRails
[10:44:10] timdotrb: has joined #RubyOnRails
[10:48:27] timdotrb: has joined #RubyOnRails
[10:48:58] Ergo: has joined #RubyOnRails
[10:50:25] Saukk: has joined #RubyOnRails
[10:52:22] apparition: has joined #RubyOnRails
[10:54:50] Torrone: nvm did it
[10:54:53] Torrone: has left #RubyOnRails: ("Leaving")
[11:08:47] jottr: has joined #RubyOnRails
[11:35:30] ldnunes: has joined #RubyOnRails
[11:40:58] Dimik: has joined #RubyOnRails
[11:41:23] Cavallari: has joined #RubyOnRails
[11:43:13] jonno112: has joined #RubyOnRails
[11:49:15] Fernando-Basso: has joined #RubyOnRails
[11:50:12] ldnunes: has joined #RubyOnRails
[11:56:22] srinidhi: has joined #RubyOnRails
[12:05:15] riotjones: has joined #RubyOnRails
[12:08:46] duderonomy: has joined #RubyOnRails
[12:39:41] MrCrackPotBuilde: has joined #RubyOnRails
[12:46:14] jottr: has joined #RubyOnRails
[12:48:50] NoGodDamnIdea: has joined #RubyOnRails
[12:49:41] rikkipitt: has joined #RubyOnRails
[12:51:01] aress190: has joined #RubyOnRails
[12:55:06] dipnlik: has joined #RubyOnRails
[12:59:58] tcopeland: has joined #RubyOnRails
[13:03:28] aress190: i recently dropped a lot of tables via migration while getting rid of a gem, ever since the drops ive been running into this error in random spots: "PG::DuplicatePstatement - ERROR: prepared statement "a1" already exists" which is being raised here: "prepare_statementactiverecord (4.2.7.1) lib/active_record/connection_adapters/postgresql_adapter.rb" -- the only thing i can think of is some sort of PG caching behind the
[13:03:28] aress190: scenes, does anyone have any insight?
[13:06:02] reber: has joined #RubyOnRails
[13:16:38] jonno112: has joined #RubyOnRails
[13:20:31] kt: has joined #RubyOnRails
[13:26:14] duderonomy: has joined #RubyOnRails
[13:28:20] riotjones: has joined #RubyOnRails
[13:33:10] rikkipitt: has joined #RubyOnRails
[13:35:11] riotjones: has joined #RubyOnRails
[13:44:21] ariejan: has joined #RubyOnRails
[13:48:34] NoGodDamnIdea: has joined #RubyOnRails
[13:57:30] Terens: has joined #RubyOnRails
[13:57:43] Terens: for specific jobs
[13:59:40] tcopeland: has joined #RubyOnRails
[14:00:01] Terens: They must be executed not at the same time. Would mutex work for this ?
[14:09:13] EspenA: has joined #RubyOnRails
[14:10:27] EspenA: Suddenly my structure.sql now explicitly state public schema everywhere after a migration. Is this a recent Rails og Postgresql change? Before search_path was set to public, now it is empty and schema explicitly stated everywhere.
[14:13:42] Saukk: has joined #RubyOnRails
[14:15:17] rikkipitt: has joined #RubyOnRails
[14:16:46] _aeris_: has joined #RubyOnRails
[14:17:54] reber: has joined #RubyOnRails
[14:19:59] rshetty: has joined #RubyOnRails
[14:25:34] DrYockel: has joined #RubyOnRails
[14:34:06] kapil___: has joined #RubyOnRails
[14:36:50] daveomcd: is it possible to do require_directory . but exclude one file?
[14:40:36] npgm: has joined #RubyOnRails
[14:42:18] ams__: has joined #RubyOnRails
[14:47:55] Sylario: @daveomcd It's not possible to directly include a dir in Ruby. You have to scan a folder for rb files and include them one by one.
[14:55:21] rafaeldelucena: has joined #RubyOnRails
[15:06:50] riotjones: has joined #RubyOnRails
[15:12:05] quazimodo: has joined #RubyOnRails
[15:12:16] riotjones: has joined #RubyOnRails
[15:16:14] Cache_Money: has joined #RubyOnRails
[15:16:43] Scient: soooooooo
[15:16:53] Scient: any chance anyone has poked around with this thing already? https://www.speedshop.co/2018/03/28/nginx-unit-for-ruby.html
[15:17:48] quazimodo: has joined #RubyOnRails
[15:23:25] dionysus69: has joined #RubyOnRails
[15:27:39] argoneus: has joined #RubyOnRails
[15:29:34] srinidhi: has joined #RubyOnRails
[15:29:59] Saukk: has joined #RubyOnRails
[15:33:19] Cache_Money: has joined #RubyOnRails
[15:39:40] quazimodo: has joined #RubyOnRails
[15:51:04] Ryzokuken: has joined #RubyOnRails
[15:53:30] thomasfedb: Radar: thoughts on the above?
[15:55:16] cagomez: has joined #RubyOnRails
[15:59:18] troys: has joined #RubyOnRails
[16:01:30] jcarl43: has joined #RubyOnRails
[16:01:36] [Butch]: has joined #RubyOnRails
[16:09:21] samort7: has joined #RubyOnRails
[16:09:48] one_zero: has joined #RubyOnRails
[16:10:23] samort7: is there a command that combines bundle update and bundle install ?
[16:10:32] cagomez: in `rspec ./spec/calculator_10_spec.rb[1:1]`, what does `[1:1]` mean?
[16:11:01] havenwood: samort7: `bundle update` already installs, no?
[16:11:24] havenwood: samort7: `bundle update` is like `rm Gemfile.lock && bundle`
[16:11:30] samort7: @havenwood oh, I wasn't sure if it did.
[16:11:52] havenwood: cagomez: line 1, character 1
[16:12:12] cagomez: havenwood: what about `[1:1:1:3]'?
[16:12:33] havenwood: cagomez: Maybe not line and char then, hah.
[16:12:33] apeiros: has joined #RubyOnRails
[16:12:59] cagomez: for context, this is from https://relishapp.com/rspec/rspec-core/docs/command-line/bisect
[16:13:14] samort7: So when I call `bundle update`, that "updates my gems". What does that mean exactly?
[16:13:48] samort7: Does it just get the latest version of each gem on the internet? Or rather, the latest version that conforms to my Gemfile specifications?
[16:13:52] havenwood: samort7: it means it deletes your Gemfile.lock, then bundles fresh
[16:14:19] havenwood: samort7: You typically don't want to run `bundle update` without arguments, unless your app is simple and unlikely to break with all dep versions changing at once.
[16:15:01] havenwood: samort7: Instead, if you need to bump an individual gem version, consider: bundle update GEM_VERSION_HERE --conservative
[16:15:02] havenwood: gem_name_here*
[16:15:51] samort7: So what's the difference between Gemfile and Gemfile.lock?
[16:15:53] havenwood: Scient: That looks really interesting.
[16:16:03] Scient: indeed it does
[16:16:17] samort7: In relation to update and install
[16:16:44] samort7: install looks at the gemfile.lock, but update looks at gemfile, then gemfile.lock/
[16:17:01] havenwood: samort7: The Gemfile is where you declare what your gem deps are. When you `bundle` it creates a Gemfile.lock that specifies the exact versions of all deps and deps of deps were installed. By committing and sharing the Gemfile.lock, you ensure that all devs working on your app are doing so with the exact same set of gems.
[16:17:52] samort7: So if I'm working on a group project - I shouldn't be calling bundle update once I clone the project
[16:17:56] samort7: Otherwise I'll have the wrong gems
[16:18:03] havenwood: samort7: Correct.
[16:18:22] havenwood: samort7: Just run `bundle` (it's an alias for `bundle install`) to install the exact versions from the Gemfile.lock.
[16:19:08] samort7: Ok, one more question - our Gemfile contains references to gems stored locally. I need to change the path in the Gemfile to where *I* have the gem. What should I do? Would I need to bundle update just that specific gem?
[16:19:24] warreng_: has joined #RubyOnRails
[16:19:47] havenwood: samort7: Yeah, `bundle update` *only* the gem you want to change.
[16:20:27] samort7: Ok. Good to know. Thanks for that!
[16:20:41] havenwood: You're welcome.
[16:24:46] warreng_: ugh... upgrading an app from rails 4.0 to 5.1 and ran into a weird issue. in a model there's a "belongs_to :foo" as well as a "def foo(bar=nil); super; nil". worked okay in 4.0 but in 5.1 i'm getting "wrong number of arguments (given 1, expected 0)". any ideas?
[16:25:16] warreng_: if i change it to just "def foo; super; end" it works fine, but something weird is going on with super() and args being passed
[16:26:15] warreng_: maybe the behavior of "super" without args changed between Ruby 2.2 and 2.4?
[16:26:58] blackcross_: has joined #RubyOnRails
[16:27:07] warreng_: yes, that's it!! "super()" works as expected
[16:28:42] fox_mulder_cp: oh. i create gem which create a json for post into external api. but when i try to use it from rails console, see, that json is wrong.
[16:29:17] jonno112: has joined #RubyOnRails
[16:29:20] fox_mulder_cp: when use it in gem /bin/console - all ok
[16:29:29] fox_mulder_cp: how i can debug it?
[16:30:36] spohnz_: has joined #RubyOnRails
[16:31:29] darkhanb: has joined #RubyOnRails
[16:38:53] riotjones: has joined #RubyOnRails
[16:42:16] riotjoe: has joined #RubyOnRails
[16:45:47] timdotrb: has joined #RubyOnRails
[16:47:41] riotjones: has joined #RubyOnRails
[16:51:06] Terens: has joined #RubyOnRails
[16:51:39] Terens: How can I execute a sidekiq job serialized ?
[16:59:01] havenwood: terens: did you end up using a mutex? there's a neat distributed mutex gem using redis: https://github.com/kenn/redis-mutex
[17:00:39] Terens: Well unless I implement a custom solution maybe with a list in redis
[17:00:46] Terens: I think mutex might be a solution
[17:01:01] havenwood: terens: Can you just use `concurrency: 1`?
[17:01:17] Terens: yes but I want only for a specific job
[17:02:08] SteenJobs: has joined #RubyOnRails
[17:03:29] havenwood: terens: i wonder if this would handle your case? i don't know: https://github.com/brainopia/sidekiq-limit_fetch
[17:04:23] Terens: maybe but seems to have no guarantees
[17:05:26] cagomez: has joined #RubyOnRails
[17:14:03] alfiemax: has joined #RubyOnRails
[17:16:32] dviola: has joined #RubyOnRails
[17:34:05] argoneus: has joined #RubyOnRails
[17:39:27] cagomez: Code is requiring many dependencies using require_dependency and filename. how do I unset these constants?
[17:44:01] Ergo: has joined #RubyOnRails
[17:45:08] woohoou: has joined #RubyOnRails
[17:54:59] jcarl43: has joined #RubyOnRails
[18:01:27] tpendragon: has joined #RubyOnRails
[18:12:00] SteenJobs: has joined #RubyOnRails
[18:19:06] SanguineAnomaly: has joined #RubyOnRails
[18:23:39] apeiros__: has joined #RubyOnRails
[18:25:06] SteenJobs: has joined #RubyOnRails
[18:29:11] schneider: has joined #RubyOnRails
[18:45:20] trautwein: has joined #RubyOnRails
[18:51:14] trautwein: has joined #RubyOnRails
[19:00:25] apeiros: has joined #RubyOnRails
[19:04:15] sameerynho: has joined #RubyOnRails
[19:08:27] reber: has joined #RubyOnRails
[19:08:38] cagomez: has joined #RubyOnRails
[19:20:29] reber: has joined #RubyOnRails
[19:21:29] alfiemax: has joined #RubyOnRails
[19:26:57] alfiemax_: has joined #RubyOnRails
[19:28:03] alfiemax: has joined #RubyOnRails
[19:35:47] dgsan: So something I've noticed can happen in one of my apps: A user leaves a form open in browser overnight. Next day they finish it and submit and it causes ActionController::InvalidAuthenticityToken to be raised because their session expired, which results in a 404. I'd prefer it just reloaded the page they were on with a "you were idle too long" type message, but I'm not sure how to differentiate this from a normal InvalidAuthenticityToken exception, wh
[19:36:55] havenwood: dgsan: How about just setting the expire_after to longer?
[19:37:31] havenwood: dgsan: maybe a week or a month?
[19:38:01] dgsan: (This is for sign up, so it's not like "session" here is related to being authed.) havenwood: That actually makes sense, I could have much longer sessions for non-authed users. (For various reasons we don't want long lived sessions for authed users.)
[19:38:43] dgsan: havenwood: Thanks, that seems like a reasonable approach to me anyway.
[19:40:15] darkhanb: Is it possible to set I18n.available_locales in ApplicationController only for certain users?
[19:40:47] darkhanb: it seems like it's a preloaded global variable
[19:46:43] harrycs: has joined #RubyOnRails
[19:51:29] za1b1tsu_: has joined #RubyOnRails
[19:54:00] schneider: has joined #RubyOnRails
[19:57:00] gambl0re: has joined #RubyOnRails
[19:57:23] harrycs: has joined #RubyOnRails
[19:59:15] harrycs: has joined #RubyOnRails
[20:01:24] SteenJobs: has joined #RubyOnRails
[20:03:40] harryv: has joined #RubyOnRails
[20:06:51] workmad3: has joined #RubyOnRails
[20:12:37] cagomez: has joined #RubyOnRails
[20:13:16] tcopeland: has joined #RubyOnRails
[20:13:21] harrycs: has joined #RubyOnRails
[20:15:22] harrycs: has joined #RubyOnRails
[20:18:44] tcopeland: has joined #RubyOnRails
[20:20:49] riotjones: has joined #RubyOnRails
[20:29:25] harrycs: has joined #RubyOnRails
[20:31:23] harrycs: has joined #RubyOnRails
[20:34:36] desnudopenguino: has joined #RubyOnRails
[20:35:07] desnudopenguino: using the roo spreadsheet gem, how does one ignore the header line in a csv spreadsheet?
[20:35:36] desnudopenguino: i tried adding { header: :first_row } and { header: true } in the args when loading the spreadsheet.
[20:36:58] shpoont: has joined #RubyOnRails
[20:43:29] desnudopenguino: ok, nevermind got that sorted
[20:46:12] Cavallari: has joined #RubyOnRails
[20:49:44] tcopeland: has joined #RubyOnRails
[20:57:49] aress190: has anyone run into this error before? PG::DuplicatePstatement - ERROR: prepared statement "a1" already exists
[21:02:05] crst: has joined #RubyOnRails
[21:03:18] SteenJobs: has joined #RubyOnRails
[21:03:51] crst: Hi, when I run Model.where(status: 'paid').each {|f| f.calculate_total_price } in console it stops during the process but doesn't show me the error. How can I see what caused the interruption?
[21:07:23] timdotrb: has joined #RubyOnRails
[21:20:13] Radar: GOOD MORNING
[21:20:38] Radar: thomasfedb: any thoughts on what specifically?
[21:25:41] havenwood: crst: If you change `each` to `find_each` does it work?
[21:31:10] crst: havenwood: oh yeah, indeed. it finishes through everything and is super fast. Unfortunately the results aren't stored in the db. http://dpaste.com/1495XS6
[21:32:46] havenwood: crst: It's just not saving.
[21:33:13] havenwood: crst: You were probably running into problems with #each because you went OOM.
[21:33:40] havenwood: With #find_each it'll default to batches of 1,000 instead of loading all the records into memory at once.
[21:34:16] havenwood: crst: Does it make sense to you why it's not saving?
[21:34:29] NoGodDamnIdea: has joined #RubyOnRails
[21:36:10] crst: havenwood: wow the find_each is so much better. What does OOM mean? At the moment it does not make sense to me why it's not saving, honestly.
[21:36:23] havenwood: crst: out of memory
[21:36:48] crst: that makes sense. it's a couple of thousand records
[21:38:09] havenwood: crst: The attribute= doesn't save to the database. This method's callback is a #before_save, so it's happening then there's a save. When you call the method directly there's not a save afterward, so the changes don't persist.
[21:38:17] shpoont: has joined #RubyOnRails
[21:38:22] havenwood: crst: https://gist.github.com/havenwood/dcdf9452476f53505b98
[21:40:49] havenwood: Where's the N/A emoji?
[21:41:29] crst: Is it replaced by FREE?
[21:41:52] havenwood: I should change ti to N/A I guess.
[21:44:46] havenwood: There, I changed it to see-no-evil monkeys.
[21:44:52] havenwood: Still totally unclear.
[21:45:40] crst: havenwood: a little better FREE though :D
[21:46:40] alfiemax: has joined #RubyOnRails
[21:47:49] crst: havenwood: Thanks so much for the explanation. I commented out the before_save and ran it again. Can you tell me if it is supposed to work then? I'm asking because it seems all fields were emptied by the calculation.
[21:50:44] havenwood: crst: No, I didn't mean to suggest removing the before_save.
[21:51:13] havenwood: The before save is triggering that method to be run before every save.
[21:51:56] havenwood: The method itself doesn't save, presumably because it's a before_save so it's guaranteed there'll be a save right after the method is called.
[21:52:18] havenwood: crst: When you call the method directly, it's not saving, and you're not saving, so nobody is saving and it doesn't get saved.
[21:53:03] desperek: has joined #RubyOnRails
[21:53:13] desperek: how do i do before_type_cast in where?
[21:53:50] desperek: that was easier than i imagined lol
[21:54:19] desperek: or it wasnt...
[21:57:12] schneider: has joined #RubyOnRails
[21:57:33] desperek: havenwood, do you have any idea?
[21:59:28] fox_mulder_cp: ahahah. i'm great! i'm add into my project second point - dns control
[22:00:12] desperek: whatcha doing fox_mulder_cp
[22:00:26] fox_mulder_cp: 2 milestones of rule the world is completed :0
[22:01:45] fox_mulder_cp: i'm create a containerized hosting control panel. domain, whois, epp, dns now reached. docker, mail, and databases in next point
[22:02:55] desperek: fox_mulder_cp, you are making a hosting :o?
[22:04:44] fox_mulder_cp: desperek: i have some small hostings, which used old, orhpaned control panels - old bitrix, self-written, obsoleted projects
[22:05:43] fox_mulder_cp: so i write modern rails + reactjs app, which can control epp, domains, dns and docker-containerized stuff - perl, php, python, go, scala...
[22:06:07] fox_mulder_cp: next big milestone - control apache cloudstack as platform
[22:07:55] fox_mulder_cp: it's a prototype. i need to rewrite it, learn testing and search next level job :)
[22:10:13] quazimodo: has joined #RubyOnRails
[22:13:28] cagomez: has joined #RubyOnRails
[22:20:26] openstruct: has joined #RubyOnRails
[22:23:44] alfiemax: has joined #RubyOnRails
[22:23:48] openstruct: Recently, I refactored a query in an app that was incredibly slow. While it's now faster, it appears that I've somehow managed to introduce a memory leak, but don't understand how it's possible. https://pastebin.com/AtKNbL4u
[22:23:49] sameerynho: has joined #RubyOnRails
[22:24:44] openstruct: For background, the exact same data structure is returned (an array of hashes) and overtime I see Ruby's heap grow due to this query and it looks like the GC isn't clearing out old references.
[22:31:39] fox_mulder_cp: oh. global refactoring - drop all views, move it to json api via active model serializers + redis as a cache and write reactjs/vue app :_
[22:32:02] crst: havenwood: Thanks man! I did this and it works now: Model.where(status: 'paid').find_each {|f| f.calculate_total_price; f.save }
[22:32:21] fox_mulder_cp: find_each -> .each
[22:32:31] fox_mulder_cp: it already founded L)
[22:32:55] hextable: has joined #RubyOnRails
[22:32:59] havenwood: crst: You can write that slightly more succinctly as: Model.where(status: 'paid').find_each(&:calculate_total_price)
[22:33:00] fox_mulder_cp: and you can write a scope
[22:33:21] hextable: hey havenwood, it's spaceghost with the lilly dog, can I drop into your queryspace?
[22:35:24] havenwood: hextable: hallooo
[22:35:30] havenwood: hextable: o/
[22:36:15] hextable: havenwood: I've got something the world is being kept away from.
[22:36:27] hextable: You do recall a ginger, yeah?
[22:36:44] havenwood: hextable: yup!! how have you been??
[22:37:05] hextable: havenwood: You know, I kind of fell out of myself, took a hiatus from what I am and who I was trying to be.
[22:37:12] hextable: But then, Fire nation attacked.
[22:37:51] hextable: Now I'm full-fledged open activist mode and I've got fights that scale up past governments.
[22:37:55] fox_mulder_cp: what is fire nation
[22:38:12] hextable: fox_mulder_cp: cultural reference to a cartoon. Um, Avatar, the last airbender.
[22:38:24] hextable: havenwood: mind if I shoot some queries your way, sir?
[22:38:45] havenwood: hextable: shoot away
[22:39:08] hextable: The latest mission I completed was Operation: Von Trappment, rescued a colony of animals from Alaska and got the state to align and give us immunity to get things done in a week.
[22:39:17] hextable: Now, I come home to police collusion.
[22:39:32] hextable: I've always said IRC is my distributed blog.
[22:39:59] fox_mulder_cp: hextable: bad idea. use twitter. it''s a offpot here
[22:40:43] _aeris_: has joined #RubyOnRails
[22:40:44] havenwood: I'm excited about the Ruby 2.5.1 release!
[22:40:45] havenwood: All the fixes I've been wanting...
[22:41:09] hextable: fox_mulder_cp: You have to get people to respond on twitter, no one but krebsonsecurity really has.
[22:42:53] Puffball: has joined #RubyOnRails
[22:44:21] crst: havenwood: hmm that's strange, when I use .find_each(&:calculate_total_price) instead nothing gets updated.
[22:44:50] havenwood: crst: It's the same thing as the other way. Check your code didn't get reverted.
[23:01:15] cagomez: has joined #RubyOnRails
[23:04:41] orbyt_: has joined #RubyOnRails
[23:06:58] tcopeland: has joined #RubyOnRails
[23:10:20] rikkipitt: has joined #RubyOnRails
[23:22:54] cschneid: has joined #RubyOnRails
[23:42:05] guacamole: has joined #RubyOnRails
[23:46:52] duderonomy: has joined #RubyOnRails
[23:53:01] Disavowed: has joined #RubyOnRails
[23:54:06] Disavowed: Afternoon all. Anyone have a recommendation for a date/time-picker for a create view? Just after something I can toss into my asset pipeline and forget about really.
[23:58:52] cstls: has joined #RubyOnRails
[23:59:07] cagomez: has joined #RubyOnRails