« Back to channel list

#RubyOnRails - 26 April 2017

« Back 1 day Forward 1 day »
[00:04:23] mjora7: has joined #RubyOnRails
[00:17:08] Darmani: has joined #RubyOnRails
[00:17:24] Darmani: Does anyone know the correct configuration for DelayedJob on Heroku?
[00:17:37] Darmani: My workers keep getting locked by the SIGTERM that Heroku throws out :[
[00:27:51] Technodrome: has joined #RubyOnRails
[00:30:25] chouhoulis: has joined #RubyOnRails
[00:31:16] romeoh_: has joined #RubyOnRails
[00:33:48] rakm: has joined #RubyOnRails
[00:43:42] my123_: has joined #RubyOnRails
[00:54:25] jarred: has joined #RubyOnRails
[00:55:17] jarred: I need to change the way paperclip paths are generated in production for (170,000+) existing records. What's the best way to do that?
[00:58:56] nikivi: has joined #RubyOnRails
[00:58:59] watersoul_: has joined #RubyOnRails
[00:59:51] dustinm`: has joined #RubyOnRails
[01:01:23] baweaver: has joined #RubyOnRails
[01:01:57] quirkycoders: has joined #RubyOnRails
[01:03:26] Vircung: has joined #RubyOnRails
[01:04:31] sevenseacat: has joined #RubyOnRails
[01:08:05] tris: has joined #RubyOnRails
[01:12:20] quazimodo: has joined #RubyOnRails
[01:13:15] nikivi: has joined #RubyOnRails
[01:15:05] Rodya_: has joined #RubyOnRails
[01:18:46] bronson: has joined #RubyOnRails
[01:19:04] quazimodo: has joined #RubyOnRails
[01:19:33] hndk: has joined #RubyOnRails
[01:22:04] nikivi: has joined #RubyOnRails
[01:23:45] cagomez: has joined #RubyOnRails
[01:26:36] patarr: has joined #RubyOnRails
[01:27:23] JusticeFries: has left #RubyOnRails: ()
[01:29:09] Jameser: has joined #RubyOnRails
[01:39:13] patarr: has joined #RubyOnRails
[01:49:18] jeffaustin81: has joined #RubyOnRails
[01:50:19] Spami: has joined #RubyOnRails
[01:51:17] rfoust: has joined #RubyOnRails
[01:51:53] bachmann: has joined #RubyOnRails
[01:52:11] Spami: I have 2 has_many relationships in a object: @car.drivers @car.passengers is there a way to merge both relationships and still use active record methods on them like .limit or .order?
[02:01:00] patarr: has joined #RubyOnRails
[02:05:03] libastral: has joined #RubyOnRails
[02:17:38] Rodya_: has joined #RubyOnRails
[02:19:12] akshat: has joined #RubyOnRails
[02:20:17] MrCrackPotBuilde: has joined #RubyOnRails
[02:21:45] szulak: has joined #RubyOnRails
[02:34:02] brent__: has joined #RubyOnRails
[02:34:49] r3vDev: has joined #RubyOnRails
[02:37:26] brent__: I've been monitoring heroku logs and when running a background worker ive been seeing an out memory swap log
[02:38:03] brent__: its running some stuff on a query result, enumerating w/ #find_each
[02:38:28] brent__: would reducing the batch_size in the #find_each help w/ memory?
[02:38:52] sevenseacat: find_in_batches will be a good start
[02:41:49] brent__: #find_each does batches
[02:41:53] brent__: w/ a default of 1000
[02:42:08] brent__: it's currently default
[02:42:24] brent__: it can take a option for batch zie
[02:43:03] brent__: wondernig if reducing that should effect memory
[02:55:26] fixture: has joined #RubyOnRails
[02:56:58] duderonomy: has joined #RubyOnRails
[03:02:20] quirkycoders: has joined #RubyOnRails
[03:06:57] rakm: has joined #RubyOnRails
[03:18:49] Rodya_: has joined #RubyOnRails
[03:23:04] Technodrome: has joined #RubyOnRails
[03:26:26] amite: has joined #RubyOnRails
[03:29:07] jeffaustin81: has joined #RubyOnRails
[03:32:52] quirkycoders: has joined #RubyOnRails
[03:34:04] quazimodo: has joined #RubyOnRails
[03:35:04] amite: Hi all, I have this piece of code for ruby written within logstash filters: https://gist.github.com/anonymous/9fd8a8fc77d20f2501c329cc12075b7d For some reason this code is causing an exception "can't dup nilclass error" i couldn't decode what this really meant, I am not a full time Ruby coder but I manage to write few lines within logstash, any help here is greatly appreciated
[03:36:06] harfangk: has joined #RubyOnRails
[03:38:57] Radar: amite: is there a stacktrace associated with that error?
[03:39:02] Radar: Or is it just that error that you see?
[03:40:53] amite: Radar: no i don't have stacktrace ..i see this when I visualize the data in Kibana interface ...rest of all my ruby code seems to work fine, but this line where I am computing time elapsed is causing exception ...
[03:41:02] Radar: amite: I don't know then, sorry.
[03:41:27] helpa: has joined #RubyOnRails
[03:43:40] amite: Radar: okay no worries, but if I may ask if this is normal according to you in ruby to do: event.set('JobElapsedTime', ((Time.parse( event.get('EndTime') )- Time.parse( event.get('StartTime') )) / 60))
[03:44:24] Radar: Yes, that seems like reasonable Ruby to me.
[03:45:52] amite: Radar: thank you, is there a way I can add debug statements in here https://gist.github.com/anonymous/9fd8a8fc77d20f2501c329cc12075b7d to generate strack trace when I run into exception?
[03:46:37] Radar: amite: You could try using plain old puts. I don't know if that would work or not.
[03:47:05] amite: Radar: okay will try ..thx!!
[03:53:25] robnester: has joined #RubyOnRails
[03:54:57] fixture: has joined #RubyOnRails
[04:00:47] bronson: has joined #RubyOnRails
[04:03:27] robnester: has joined #RubyOnRails
[04:19:22] Rodya_: has joined #RubyOnRails
[04:42:57] jeffaustin81: has joined #RubyOnRails
[04:53:58] jeffaustin81: has joined #RubyOnRails
[04:55:13] bachmann: has joined #RubyOnRails
[05:17:30] mjora7: has joined #RubyOnRails
[05:20:10] Rodya_: has joined #RubyOnRails
[05:24:29] armyriad: has joined #RubyOnRails
[05:28:36] Jameser: has joined #RubyOnRails
[05:37:36] Jameser: has joined #RubyOnRails
[06:14:46] mochiyoda: has joined #RubyOnRails
[06:16:13] ferr: has joined #RubyOnRails
[06:20:58] Rodya_: has joined #RubyOnRails
[06:28:07] conta: has joined #RubyOnRails
[06:37:31] srinidhi: has joined #RubyOnRails
[06:51:34] mjora7: has joined #RubyOnRails
[06:51:56] vedu: has joined #RubyOnRails
[06:59:10] cagomez: has joined #RubyOnRails
[07:12:44] DrYockel: has joined #RubyOnRails
[07:21:37] Rodya_: has joined #RubyOnRails
[07:28:45] Qchmqs: has joined #RubyOnRails
[07:33:35] frojnd: has joined #RubyOnRails
[07:33:37] frojnd: Hello there.
[07:34:39] tbuehlmann: frojnd: I was about to respond to your question yesterday, but you left :'(
[07:34:52] frojnd: tbuehlmann: jejks :(
[07:35:09] frojnd: Are you still in the play?
[07:36:08] tbuehlmann: naw, got things to do
[07:36:56] frojnd: tbuehlmann: the question was: how can I modify root path globally for links on the page from "/" to "/supervisor_users/"
[07:36:59] frojnd: tbuehlmann: ok
[07:37:40] tbuehlmann: maybe just check the routing guide for optional route segments, like *prefix. maybe in a scope call
[07:38:35] frojnd: Also I have another question. I created another user model "SupervisorUser" which has has_secure_password. All good and dandy when I create user it has random value inside password.. but when I try to login and I set binding.pry inside sessiosn controller I see plain password for :password symbol. Why is that?
[07:38:48] frojnd: tbuehlmann: I tried with routes but I think it's not good
[07:41:59] pLaTo0n: has joined #RubyOnRails
[07:48:29] frojnd: I mean I would like to add "/supervisor_users/" to existing views
[07:48:47] frojnd: I mean I would like to add "/supervisor_users/" to existing views's urls wherever link or button is
[07:49:36] patarr: has joined #RubyOnRails
[08:03:48] akshat: has joined #RubyOnRails
[08:07:14] dionysus69: has joined #RubyOnRails
[08:07:57] mikecmpbll: has joined #RubyOnRails
[08:09:38] srinidhi: has joined #RubyOnRails
[08:11:22] patarr: has joined #RubyOnRails
[08:13:04] Arkentias: has joined #RubyOnRails
[08:14:42] mjora7: has joined #RubyOnRails
[08:15:01] shotbug: has joined #RubyOnRails
[08:22:21] Rodya_: has joined #RubyOnRails
[08:25:17] xco: has joined #RubyOnRails
[08:26:07] xco: has joined #RubyOnRails
[08:26:53] xco: has joined #RubyOnRails
[08:27:41] xco: has joined #RubyOnRails
[08:28:26] xco: has joined #RubyOnRails
[08:29:16] xco: has joined #RubyOnRails
[08:30:04] xco: has joined #RubyOnRails
[08:30:52] blackmesa: has joined #RubyOnRails
[08:31:10] xco: has joined #RubyOnRails
[08:36:30] Jameser: has joined #RubyOnRails
[08:38:22] tedwing: has joined #RubyOnRails
[08:52:35] workmad3: has joined #RubyOnRails
[08:54:32] lxsameer: has joined #RubyOnRails
[08:56:48] Sylario: has joined #RubyOnRails
[09:07:39] marr: has joined #RubyOnRails
[09:15:01] dangerousdave: has joined #RubyOnRails
[09:19:48] sonOfRa: has joined #RubyOnRails
[09:23:12] Rodya_: has joined #RubyOnRails
[09:23:48] quazimodo: has joined #RubyOnRails
[09:38:07] r3vDev: has joined #RubyOnRails
[09:44:42] arBmind: has joined #RubyOnRails
[09:45:53] dionysus69: if I import jquery_ujs, do I need to remove rails_ujs?
[09:46:13] dionysus69: I am having trouble with making bootstrap javascript to work
[09:47:54] dminuoso: What is that bootstrap you keep talking about?
[09:58:45] dangerousdave: has joined #RubyOnRails
[09:58:49] dionysus69: the frontend framework dminuoso? :D
[09:58:54] dionysus69: is that a joke?
[09:59:03] dminuoso: I dont make jokes.
[09:59:18] dionysus69: why is that?
[09:59:50] shotbug: has joined #RubyOnRails
[10:01:18] dminuoso: Im just an ignorant bastard.
[10:07:15] stamina: has joined #RubyOnRails
[10:09:50] shilon: has joined #RubyOnRails
[10:09:50] r3vDev: has joined #RubyOnRails
[10:23:23] ErhardtMundt: has joined #RubyOnRails
[10:24:57] dionysus69: I don't believe you
[10:26:26] arBmind: has joined #RubyOnRails
[10:38:53] drale2k_: has joined #RubyOnRails
[10:39:17] lxsameer: has joined #RubyOnRails
[10:45:12] shilon: has left #RubyOnRails: ()
[10:56:24] quazimodo: has joined #RubyOnRails
[10:57:55] pLaTo0n: has joined #RubyOnRails
[11:04:37] drale2k_: has joined #RubyOnRails
[11:07:21] Saukk: has joined #RubyOnRails
[11:21:48] beauby: has joined #RubyOnRails
[11:24:32] Rodya_: has joined #RubyOnRails
[11:26:26] drale2k_: has joined #RubyOnRails
[11:29:58] r3vDev: has joined #RubyOnRails
[11:35:27] blackmesa: has joined #RubyOnRails
[11:39:57] dionysus69: I have trouble including app.js from glimmer web-component into asset pipeline
[11:40:19] dionysus69: I get TypeError: parent is null and a broken asset pipeline, all other js imports are broken
[11:40:47] dionysus69: all there is in this glimmer app is hello world... so I dont understand how else to load it
[11:41:01] dionysus69: atm it is in assets/javascripts/app.js
[11:41:23] dionysus69: it works fine when I import it from erb like <%= javascript_include_tag "app" %>
[11:44:06] arBmind: has joined #RubyOnRails
[11:49:21] Pumukel: has joined #RubyOnRails
[11:54:40] kristofferR: has joined #RubyOnRails
[11:57:00] frojnd: When I have resources outside and inside of the scope/module it finds edit_product for outside of scope but not for inside of scope... when I comment resources from outside of scope it finds edit_product... resources are the same name inside and outside
[11:57:35] tbuehlmann: frojnd, first assumption: it uses the first matching
[11:59:09] xco: has joined #RubyOnRails
[12:06:42] frojnd: tbuehlmann: can I not use the same name for scope and outside?
[12:08:25] tbuehlmann: show some code
[12:08:25] frojnd: https://gist.github.com/frojnd/7d5f40c4e1f0a599dcaa4228dff30add
[12:08:42] frojnd: tbuehlmann: I added routes + rake routes
[12:09:19] frojnd: If I leave out as: 'test' then I don't see edit_product for supervisor_users
[12:09:47] frojnd: how can I have two names for outside and inside of scope?
[12:11:48] frojnd: tbuehlmann: how can I have one name for inside/outside of scope? Please do share if it's possible :)
[12:12:33] tbuehlmann: I don't get it
[12:12:49] sevenseacat: you can't reuse the same route name
[12:13:02] sevenseacat: apart from that, I don't get the question
[12:15:27] frojnd: sevenseacat: that's exactly what I'm asking
[12:15:33] frojnd: but why not it's in different scope
[12:16:02] sevenseacat: route names must be unique.
[12:16:06] sevenseacat: scope is irrelevant.
[12:17:43] quirkycoders: has joined #RubyOnRails
[12:18:22] chouhoulis: has joined #RubyOnRails
[12:18:22] sevenseacat: and route names must be unique because if you say "redirect to my_route_path", which one does it choose?
[12:18:44] chouhoulis: has joined #RubyOnRails
[12:19:29] chouhoulis: has joined #RubyOnRails
[12:19:53] frojnd: the one I override or not :(
[12:20:03] frojnd: I have one view for scope and without scope
[12:20:16] chouhoulis: has joined #RubyOnRails
[12:20:23] sevenseacat: views are not relevant when talking about routes
[12:20:27] frojnd: so I figured when I'm in scope and within my custom class I could just override old paths with new path
[12:21:01] chouhoulis: has joined #RubyOnRails
[12:21:18] frojnd: Imagine..
[12:21:19] sevenseacat: I have a feeling we're talking past each other.
[12:22:09] adlerdias: has joined #RubyOnRails
[12:22:38] frojnd: sevenseacat: let me explain what I have: I have a view. Inside of a view a bunch of paths... that are like edit_product_path(id) but when logged in as superuser I'm using new scope /superuser/ so in order to use old views with new scope I'd have to override old path inside my base controller to use new scope
[12:22:49] chouhoulis: has joined #RubyOnRails
[12:25:05] frojnd: I was able to do it for show action
[12:25:25] tedwing: has joined #RubyOnRails
[12:25:28] Rodya_: has joined #RubyOnRails
[12:25:34] chouhoulis: has joined #RubyOnRails
[12:25:57] tbuehlmann: frojnd: have you thought about having an admin namespace and administrating your objects in there?
[12:27:05] frojnd: tbuehlmann: I have
[12:27:30] frojnd: it was a typo all the way :( my helper_method :edit_prooduct_path :(
[12:30:16] frojnd: Yeah I get
[12:31:01] pupsicle: has joined #RubyOnRails
[12:32:14] bachmann: has joined #RubyOnRails
[12:37:39] chouhoulis: has joined #RubyOnRails
[12:37:41] justAllgood: has joined #RubyOnRails
[12:44:54] dangerousdave: has joined #RubyOnRails
[12:46:03] arBmind: has joined #RubyOnRails
[12:52:53] bbrowning_: has joined #RubyOnRails
[13:05:15] mices: has joined #RubyOnRails
[13:05:47] Dreamer3: has joined #RubyOnRails
[13:06:17] mices: anyone can guess whats happenning here why the same select fails then succeeds after render https://gist.github.com/mices/3feec50a6ff92cc768f1d4b06f168573
[13:09:33] drale2k_: has joined #RubyOnRails
[13:11:16] justAllgood: has joined #RubyOnRails
[13:12:07] drale2k_: has joined #RubyOnRails
[13:19:49] tercenya: has joined #RubyOnRails
[13:23:31] universa1: mices: i doubt it is the select that is rolled back ;)
[13:26:10] Rodya_: has joined #RubyOnRails
[13:29:50] dangerousdave: has joined #RubyOnRails
[13:32:25] DLSteve: has joined #RubyOnRails
[13:37:11] pLaTo0n: has joined #RubyOnRails
[13:38:36] shilon: has joined #RubyOnRails
[13:39:00] rfoust: has joined #RubyOnRails
[13:41:44] solars: has joined #RubyOnRails
[13:42:33] solars: hey, quick rspec question: if I want to stub a class that is called outside of my spec, e.g. RestClient, is the correct way to do it with: RestClient = double; RestClient.stub(:get) {} ?
[13:43:11] mikecmpbll: [offtopic] with monit, does anyone know if it's possible to monitor the totalmem of multiple processes combined, and restart them all when above a threshold?
[13:45:05] deur-: solars: in rspec3 syntax you could do allow(RestClient).to receive(:get) {}
[13:46:30] deur-: solars: depending on what you want to do, WebMock might be useful (https://github.com/bblimke/webmock)
[13:50:37] justAllgood: has joined #RubyOnRails
[13:56:42] solars: deur-: you're of course right in this example - I had instances in my mind, but obviously that's a different case
[13:57:10] solars: with instances it only works with expect_any_instance_of() - but this seems to be old. any idea how I would write this in the newer syntax?
[13:57:48] deur-: solars: allow_any_instance_of :)
[13:58:29] solars: hmm I thought that's old
[13:58:31] deur-: solars: or bind the stub on an instance itself with the basic allow(object).to receive(:method) {}
[13:58:43] solars: expect is not the same as allow, right
[13:59:11] solars: the problem is if the object is created outside of your spec, you cannot directly use the double then
[13:59:51] deur-: yes, that's true. in this case you'll have to work with allow_any_instance_of to make it override when it's created
[14:00:10] mostlybadfly: has joined #RubyOnRails
[14:00:24] solars: why is this under "how to work with legacy code" in the docs?
[14:00:28] solars: I don't get that
[14:01:40] deur-: no idea tbh, I haven't gotten deprecation warnings during test runs
[14:03:31] deur-: solars: I assume they mean that, when working in legacy code, you often need to hijack class instances this way to build rudimentary tests
[14:05:43] justAllgood1: has joined #RubyOnRails
[14:06:21] Twinings: has joined #RubyOnRails
[14:07:02] deur-: yeah, just found the relevant page; it's a guideline on how to start testing legacy apps, not a deprecation thing :)
[14:08:40] solars: deur-: ah yeah that might make sense
[14:08:51] solars: it's a bit misleading :)
[14:10:06] mustmodify: has joined #RubyOnRails
[14:10:17] HoierM: has joined #RubyOnRails
[14:10:19] bahamas: has joined #RubyOnRails
[14:10:57] mustmodify: Rails seems faster with SSDs but not as fast as I had expected. Especially at startup. Any thoughts about why? Is parsing code really that much slower than reading files?
[14:13:39] bahamas: hello. I'm trying to modify an open source rails project and I need some help (because I don't have any Rails experience). for this specific task, I need to add two check boxes to a form. I have done that and I get the following error "undefined method `political_affiliation' for #<Profile:0x00000004491ac0>". "political_affiliation" is one of the fields. I don't understand how I can add it to the
[14:13:45] bahamas: Profile though. I've looked in app/models/profile.rb, but there are no fields defined there
[14:13:48] drale2k_: has joined #RubyOnRails
[14:14:10] Twinings: Hi. Here is a question. So, we recently upgraded to rails 4, and had to turn off caching config.action_controller.perform_caching = false, because it seemed the caching (dalli_store) was not distinguishing between mobile and desktop versions of the pages, per the mobile_fu gem. It was mixing up, or considering them the same page. Makes sense. Any ideas how to.. fix this? I think it was even working ok in rails 3.
[14:18:08] mustmodify: bahamas: let's start at the beginning.
[14:18:13] mustmodify: What database are you using?
[14:19:46] bahamas: mustmodify: postgres
[14:24:43] drale2k_: has joined #RubyOnRails
[14:26:52] Rodya_: has joined #RubyOnRails
[14:27:22] quirkycoders: has joined #RubyOnRails
[14:28:55] bahamas: mustmodify: next?
[14:32:19] theunraveler: has joined #RubyOnRails
[14:36:00] shilon: has joined #RubyOnRails
[14:36:21] patarr: has joined #RubyOnRails
[14:44:39] r3vDev: has joined #RubyOnRails
[14:45:37] mustmodify: sorry, lots going on.
[14:45:42] mustmodify: Have you run migrations?
[14:45:48] fox_mulder_cp: has joined #RubyOnRails
[14:46:23] justAllgood: has joined #RubyOnRails
[14:46:33] fox_mulder_cp: wow. One of greatest city in my country on Guardian paper ^) https://www.theguardian.com/cities/2017/apr/24/trash-talk-lviv-rubbish-crisis-ukraine
[14:47:54] bahamas: mustmodify: yes. nothing changed. meaning I didn't see any output
[14:48:06] dionysus69: has joined #RubyOnRails
[14:48:16] Technodrome: has joined #RubyOnRails
[14:48:22] bahamas: fox_mulder_cp: I was there. I liked it
[14:48:51] gambl0re: has joined #RubyOnRails
[14:49:09] User458764: has joined #RubyOnRails
[14:50:23] chouhoulis: has joined #RubyOnRails
[14:50:57] fox_mulder_cp: i live in Kyiv )
[14:53:08] justAllgood1: has joined #RubyOnRails
[14:53:10] gamblor3: has joined #RubyOnRails
[14:53:15] bahamas: I liked Kyiv as well. different from Lviv, more spread out. but I still liked it
[14:53:39] kristofferR: has joined #RubyOnRails
[14:54:44] fox_mulder_cp: i sometimes want to migrate to village, but all big companies located here
[14:54:45] Doldge: has joined #RubyOnRails
[14:54:57] beauby: has joined #RubyOnRails
[14:58:10] cecilgol: has joined #RubyOnRails
[14:59:32] bbrowning: has joined #RubyOnRails
[14:59:38] cecilgol: im struggling to find any documentation about setting up an app environment thats not the default 3. i'd like to use my laptop as a fourth dev environment when im away from my office servers, has anyone successfully set something like this up?
[15:00:09] shotbug: has joined #RubyOnRails
[15:00:15] mustmodify: bahamas: so your database includes the columns you're referencing? Are they listed in db/schema.rb?
[15:01:36] cecilgol: basically, when im out of office, id like to set an ENV var to use the "laptop" config/db entry, etc...
[15:05:54] bahamas: mustmodify: I only added them to the view. will running db:migrate add them to the schema? they're not anywhere else
[15:15:33] Qchmqs: has joined #RubyOnRails
[15:18:05] choke: has joined #RubyOnRails
[15:27:00] AzaToth: has joined #RubyOnRails
[15:27:44] dblessing: has joined #RubyOnRails
[15:27:45] Rodya_: has joined #RubyOnRails
[15:28:36] spectra: has joined #RubyOnRails
[15:29:01] patarr1: has joined #RubyOnRails
[15:34:17] bahamas: mustmodify: to make it simpler. these are fields of the type I accept the terms and conditions. I see Rails gives them special treatment http://guides.rubyonrails.org/active_record_validations.html#acceptance. I added them to my Profile, but they didn't stop me from creating a profile, even though I didn't tick them
[15:35:57] Twinings: bahamas: these may be special fields. For typical fields though, you would need to add them into migrations. Run db:migrate. That updates the schema, and creates them in the database tables.
[15:36:31] Twinings: terms and conditions, may be special case.
[15:36:56] bahamas: Twinings: this is my single use case. I want two fields that the users need to tick. otherwise they can't sign up. what else do I need to do, besides adding them to the profile?
[15:38:10] Twinings: you posted a link. Did you add that code? class Person < ApplicationRecord validates :terms_of_service, acceptance: true end
[15:39:02] Twinings: google rails terms of service. http://stackoverflow.com/questions/6324048/accept-terms-of-use-rails
[15:39:43] Twinings: that stackoverflow article looks quite good
[15:40:22] Twinings: get it working with only one check first. Easier.
[15:40:29] Twinings: Then add the next.
[15:41:48] bahamas: Twinings: yes, I added it. then I tried to sign up and it allowed me. btw, just to make sure. I don't need to also add the fields in the view?
[15:43:02] Twinings: The article does refer to the views.
[15:44:13] bahamas: yes, I saw now.
[15:47:40] Pumukel: has joined #RubyOnRails
[15:48:00] shilon: has joined #RubyOnRails
[15:52:43] bahamas: btw, Twinings, do you know how I can add a text with a hyperlink in the label form? I want something like label: 'I have read the [Code of Conduct](link/to/code/of/conduct)'.
[15:53:21] kristofferR: has joined #RubyOnRails
[15:55:02] Twinings: google rails hyperlink in label. http://stackoverflow.com/questions/11075243/include-link-in-form-label
[15:55:04] beauby: has joined #RubyOnRails
[15:56:05] [Butch]: has joined #RubyOnRails
[15:58:55] bahamas: Twinings: thank you. btw, I have added the fields in the view and the profile, but I'm still allowed to create a profile. what could I be missing?
[15:59:00] shilon: has left #RubyOnRails: ()
[16:01:36] Twinings: bahamas: you need to reboot.
[16:01:45] Twinings: just kidding.
[16:04:38] shilon: has joined #RubyOnRails
[16:04:57] shilon: has left #RubyOnRails: ()
[16:05:54] bahamas: I had anyway :)
[16:09:01] morfin: has joined #RubyOnRails
[16:12:57] theunraveler: has joined #RubyOnRails
[16:18:25] blackmesa: has joined #RubyOnRails
[16:19:44] Technodrome: has joined #RubyOnRails
[16:20:40] xco: has joined #RubyOnRails
[16:21:22] mdw: has joined #RubyOnRails
[16:22:34] Rodya_: has joined #RubyOnRails
[16:27:05] harfangk: has joined #RubyOnRails
[16:27:40] mdw: has joined #RubyOnRails
[16:28:30] mdw: has joined #RubyOnRails
[16:29:09] tfitts: has joined #RubyOnRails
[16:30:50] fixture: has joined #RubyOnRails
[16:31:29] gusrub: has joined #RubyOnRails
[16:31:38] tfitts: I'm making a rails 5 api app. I'm wondering if there is a standard or recommended way to protect certain model fields or attributes from being included included in the serialized payload based on user permissions and also preventing changes to fields based on permissions as well
[16:37:40] baweaver: strong params, jbuilder
[16:47:45] mustmodify: has left #RubyOnRails: ()
[16:49:44] mordof: has joined #RubyOnRails
[16:52:56] quirkycoders: has joined #RubyOnRails
[16:53:11] mordof: I've got a really strange circular reference issue happening after updating to rails 5 (or more specifically, activerecord/model/support 5 - this environment isn't specifically rails). I have 4 models - Agency, Client, Presence, and Node. Agency is at the top of the hierarchy, it contains clients, those contains presences. a Node is an ambiguous r
[16:53:12] mordof: eference to each (each agency, client, and presence has their own node entity). When an agency/client/presence gets made, there's an after_create to make a node for it also. after an update of each, there's an around_save which updates the relevant node
[16:54:00] mordof: Because of the around_save call - which calls node.save.. if i have has_one :presence in my node.rb model while the around_save is called for the presence, it creates a circular reference somehow
[16:54:08] fixture: has joined #RubyOnRails
[16:54:27] dblessing: has joined #RubyOnRails
[16:54:29] mordof: presence has a belongs_to :node, dependent: :destroy, optional: true on it. this circular reference didn't exist for rails 4.2
[16:54:43] mordof: and i'm having a very difficult time figuring out what to do about it
[16:55:17] mordof: essentially it seems like when the presence gets saved, it triggers the around save - which updates the node, which is somehow triggering a save on the presence again (even though there's no callbacks to do so)
[16:56:16] mordof: i imagine i won't get any feedback to actually fix my issue directly - but does anyone know how i would go about trying to solve this issue? the stack trace doesn't show me any of my code except the around_save node.save call. everything else is inside of active record/support
[16:57:19] mordof: i'm not even sure I understand the situation enough to recreate it in a fresh rails 5 app.. so i'm hesitant to put the time into trying it at the moment. but right now that's the only thing i can think of
[16:57:21] fixture: has left #RubyOnRails: ()
[16:59:55] kristofferR: has joined #RubyOnRails
[17:01:14] patientj: has joined #RubyOnRails
[17:01:15] mariusm: has joined #RubyOnRails
[17:01:38] gusrub: has joined #RubyOnRails
[17:01:41] dblessing: has joined #RubyOnRails
[17:02:34] mariusm: has left #RubyOnRails: ()
[17:09:55] polishdub: has joined #RubyOnRails
[17:11:54] ResidentBiscuit: has joined #RubyOnRails
[17:16:13] mikecmpbll: has joined #RubyOnRails
[17:19:59] patarr: has joined #RubyOnRails
[17:32:19] aseibert: has joined #RubyOnRails
[17:41:25] r3vDev: has joined #RubyOnRails
[17:41:34] patarr: has joined #RubyOnRails
[17:44:13] justAllgood: has joined #RubyOnRails
[17:47:51] akshat: has joined #RubyOnRails
[17:48:05] Technodrome: has joined #RubyOnRails
[17:51:01] sandstrom: has joined #RubyOnRails
[17:52:05] Kilo`byte: i am having issues getting puma installed. Inparticular does it complain about the DH struct being abstract (native code)
[17:52:38] soahccc: has joined #RubyOnRails
[17:54:36] hobodave: has joined #RubyOnRails
[18:06:31] universa1: has joined #RubyOnRails
[18:07:35] mustmodify: has joined #RubyOnRails
[18:07:39] mustmodify: If I need to calculate % change, should I put that in Math? Or like ... Math::PercentChange.for(a, b)? What's an appropriate interface? Right now it's in a view helper. Which is fine except it's harder to test.
[18:07:53] mustmodify: (cross-posted from the idle #ruby)
[18:08:00] baweaver: I wouldn't go monkeypatching Math
[18:08:22] baweaver: I'd just put it in a helper somewhere: def percent_change(a,b)
[18:08:30] baweaver: doesn't need to be much more complicated than that
[18:09:17] mustmodify: has left #RubyOnRails: ()
[18:09:25] mustmodify: has joined #RubyOnRails
[18:12:00] justAllgood: has joined #RubyOnRails
[18:18:41] funnel: has joined #RubyOnRails
[18:24:38] gusrub: has joined #RubyOnRails
[18:26:58] pLaTo0n: has joined #RubyOnRails
[18:29:12] rakm: has joined #RubyOnRails
[18:32:44] gambl0re: has joined #RubyOnRails
[18:34:10] gusrub: has joined #RubyOnRails
[18:34:44] Slogger: Anyone ever tried adapting active record models to have a hybrid back-end? For example, some attributes from a DB, others from Redis, and some from an API? Or maybe rather than do something like that it's just better to delegate attributes to client objects? (My fear being that delegation might not easily combine with features like validation or save hooks.)
[18:37:41] mustmodify: has left #RubyOnRails: ()
[18:38:21] mordof: Slogger: We have different models each pointing to various back-ends, but I don't think any model is itself using multiple back-ends.. well, we do have one that communicates with an API and they both store the information
[18:38:43] mordof: it used to be hybrid i suppose.. but honestly it's very, very yucky to do it that way and poses a lot of troubles
[18:39:01] mordof: always have a single source of truth, and then provide info to one or the other as needed (callbacks, etc)
[18:39:15] mordof: otherwise if bugs happen, and you don't know which side is considered source of truth - you will have a nightmare resolving it
[18:39:25] mochiyoda: migrations don't seem to generate correct teardown sql for indexes and FKs when using schema-qualified tables (pg). should they?
[18:41:46] mordof: So I made my earlier stack-level too deep issue into an example project: https://github.com/mordof-work/test_environment The main issue that I could identify is that agency/client/presence have an around_save which triggers a save on node, and the relationships then cause a circular reference
[18:42:29] mordof: Can anyone help take a look at my code there (primarily the models files contain the issue - everything else is setup to run things). Am I doing something wrong/weird?
[18:42:44] Slogger: mordof: I'm not keen on doing things that way, frankly. But SSOT issues lead me to want to have certain data only pulled from an API (with caching, probably), but at the same time the data pulled from the API is so central what the application will be doing that it'll be a recurring hassle to have it too distanced from the model side. Siamese Twin Models don't really seem fun.
[18:43:22] justAllgood1: has joined #RubyOnRails
[18:44:23] mordof: Slogger: having one side keep all the info, and just provide the other side with information whenever it updates is about the closest thing to a sane way of handling it i've tried to do.. Not saying it's the best, i don't know, but we tried having some info on one side, some info on the other, and it was a nightmare. Keep all info on both if you n
[18:44:23] mordof: eed, but decide on which side controls the info for any event where issues occur
[18:44:56] blackmesa: has joined #RubyOnRails
[18:44:59] mordof: other approaches to keep data synced can be complex to manage..
[18:45:37] mordof: Slogger: hmmm maybe ignore what i just said, lol
[18:46:01] mordof: Slogger: didn't know what SSOT was and assumed it was some platform/lib, lol. but it seems we're talking about the same thing and you have concerns about doing that
[18:46:16] sandstrom: has joined #RubyOnRails
[18:47:48] Slogger: mordof: I'd guess your circular reference issue is a byproduct of a factory girl setup, but can't see where the the Factory Girl stuff is actually setup.
[18:47:52] mordof: Slogger: too distanced from the model side. I'm not sure what you mean there. We have all of our stuff done model-side
[18:47:59] futilegames: has joined #RubyOnRails
[18:48:04] mordof: Slogger: it's in init.rb
[18:48:14] mordof: it's very basic
[18:48:28] mordof: I can also remove factory girl entirely - it was just easier to use that
[18:49:01] mordof: I guess that's something to test - if it's somehow a factory girl issue then I really should try it without that
[18:51:57] mordof: Slogger: took factory girl out - same ordeal. updating github
[18:52:15] Slogger: So with factories I think you'll get a circular reference error unless you take advantage of more advanced factory setups to make one of the factories build its child with a reference to its parent. Because I think out of the box the references will be to a new object of the type. Could be wrong. I think I had to use an after(:create) and then assign a reference to a parent object or something along those lines in one of my previous projects.
[18:53:01] mordof: Slogger: confirmed it's not a factory girl issue. it's in the models themselves
[18:53:30] mordof: test.rb without factory girl just creates the agency/client/presence and hooks them together manually now if not using factory girl
[18:53:43] mordof: ... redundancy
[18:54:05] mordof: ACTION needs to figure out how to make ruby show the full stack trace and not truncate it
[18:54:45] mordof: i'm actually just gonna take factory girl entirely out of the code... there's no point having it there if it's not part of the problem
[18:56:36] mordof: even just creating a single Agency gives me stack level too deep
[19:01:23] Slogger: Maybe, if node reference itself (the Agency), it constantly recalls update_node?
[19:01:40] mordof: node doesn't reference itself though
[19:01:44] mordof: node only has a has_one :agency in it
[19:02:20] mordof: there's nothing in here that actually triggers node to interact back to the agency it has.. which would be required for update_node to be triggered again
[19:03:35] mordof: nevermind, still breaks when inheriting from ActiveRecord::Base and not ApplicationRecord
[19:03:51] Slogger: link_node seems to create_node, which should provide the current model as a reference, right?
[19:04:40] Slogger: Which might mean a double save happens.
[19:04:40] mordof: i guess i can look at the source for create_node, but in this case there's no reason for it to
[19:05:22] mordof: the actual issue stems from when node.save is called inside update_node. if i comment that save out, that's when the circular reference stops
[19:05:28] mordof: so it's only on actually updating the node.
[19:05:41] mordof: but that code shouldn't even be running - unless Rails 5 broke new_record?
[19:05:50] Slogger: Double save
[19:06:07] Gm4n: has joined #RubyOnRails
[19:06:10] mordof: that shouldn't matter though either - node is a different entity than agency
[19:06:42] mordof: even if node got saved 50 times - i don't see a way for that to affect the agency record
[19:07:19] mordof: obviously - i'm going to check everything and test out what you're suggesting, because i'm at a loss and that's why i came here for help. my apologies if i sound argumentative over the matter
[19:07:27] mordof: just voicing my confusion, heh
[19:08:29] ravster: has joined #RubyOnRails
[19:08:56] DrYockel1: has joined #RubyOnRails
[19:09:26] patarr: has joined #RubyOnRails
[19:10:55] Slogger: I'm not real sure, because I don't entirely know how non-model-name reference work, but I think when you build_<x> or create_<x> in context of an object it is automatically build to reference the current object if possible. Which means when it saves it needs the reference model to save first to set the id for the relation, which would be save #1 on Agency, then after node saves, it would save Agency again... I'm not sure where the infinite recursi
[19:11:35] Slogger: Anyway, probably wrong theory.
[19:11:39] mordof: i'll double check that. in rails 4.2 that's not how create_<x> functioned - but they may have updated it
[19:12:00] mordof: something changed between rails 4.2 and rails 5 to cause this code to break
[19:12:11] justAllgood: has joined #RubyOnRails
[19:12:12] bachmann: has joined #RubyOnRails
[19:12:16] Rodya_: has joined #RubyOnRails
[19:12:16] mordof: ACTION is setting up a flag to be able to run it as either version now
[19:12:36] quirkycoders: has joined #RubyOnRails
[19:13:08] Slogger: I guess you could try doing Node.create and see if something different happens as the easy test.
[19:13:20] mordof: good call
[19:13:30] mordof: almost done setting this up - and i'll test and see if anything odd happens to NOde
[19:17:33] mordof: aaand my test environment is behaving the same way with using rails 4.2.6 libraries as it is with rails 5 -.-
[19:17:41] mordof: so i may have just broken something and not realised it
[19:22:22] rkellermeyer: has joined #RubyOnRails
[19:23:24] quirkycoders: has joined #RubyOnRails
[19:40:54] mordof: Slogger: for the create_<x> any chance you know how to find a documentation page for that?
[19:45:49] futilegames: has joined #RubyOnRails
[19:46:23] LightStalker: has joined #RubyOnRails
[19:48:22] mordof: Slogger: at this point my guess is that in my actual production code, for Rails 4.2, there's something *preventing* this circular reference from being a problem.. I've run a diff on the files I originally thought were only relevant to the problem, and there's very very little change between them. my test environment reflects those changes.. *sighs*
[19:48:26] mordof: needle in a haystack -.-
[19:48:56] raul782: has joined #RubyOnRails
[19:50:21] raul782: hey guys, Ic that rails 3.2.x supports ruby 2.3, would it support 2.4?
[19:50:57] darkmug: has joined #RubyOnRails
[19:51:43] mordof: that's quite the situation to be in to be using a rails version that old, with a newer version of ruby
[19:51:53] mordof: i don't know the answer to your question though
[19:54:53] drale2k_: has joined #RubyOnRails
[19:56:39] gusrub: has joined #RubyOnRails
[19:59:49] gusrub: has joined #RubyOnRails
[20:03:19] raul782: Well, I guess I'll try
[20:04:02] raul782: I've already tested 2.3 and it works on this app. We plan on upgrading all the way to 5.x but we're splitting the work.
[20:05:11] mordof: I remember 3.x to 4.2 being a lot of work. it's good you have multiple people working on it
[20:05:23] mordof: i'm in the middle of doing a 4.2.6 to 5.0.2 upgrade
[20:09:01] ResidentBiscuit: has joined #RubyOnRails
[20:09:26] ResidentBiscuit: has joined #RubyOnRails
[20:09:51] ResidentBiscuit: has joined #RubyOnRails
[20:10:16] ResidentBiscuit: has joined #RubyOnRails
[20:11:03] ResidentBiscuit: has joined #RubyOnRails
[20:14:08] mordof: raul782: by chance I think i found the answer to your question
[20:14:19] mordof: http://stackoverflow.com/questions/41504106/ruby-2-4-and-rails-4-0-8-stack-level-too-deep-systemstackerror read the answer, not the question
[20:15:16] raul782: mordof: aha, Ic.
[20:15:20] mordof: even rails 4.2 does not support ruby 2.4 without that patch to rails - i imagine rails 3 would have just as many issues
[20:15:25] mordof: but likely without a patch
[20:15:35] raul782: yeah, it makes sense.
[20:15:50] mordof: i'm dealing with a stack level too deep issue in my upgrade .. fun coincidence
[20:16:20] raul782: Thanks, I'll stick then with ruby 2.3 and when I upgrade to 5.x we might try updating ruby.
[20:16:53] mordof: i'm just gonna stick with 2.3 for 5.x anyhow - 5.x states supported ruby version at >= 2.2
[20:17:06] mordof: unless there's something cool in 2.4 you want i guess
[20:17:15] mordof: ACTION hasn't looked at the changelog for 2.4 yet
[20:17:36] lxsameer: has joined #RubyOnRails
[20:31:07] pupsicle: has joined #RubyOnRails
[20:31:13] bachmann: has joined #RubyOnRails
[20:33:32] darkmug: has joined #RubyOnRails
[20:35:11] defswork: has joined #RubyOnRails
[20:42:05] lupine: I see 2.3, I think rails2.3
[20:42:26] mordof: ruby 2.3* is what we're currently on
[20:42:31] mordof: going from 4.2.6 rails to 5.0.2 rails
[20:45:43] patientj: has left #RubyOnRails: ()
[20:52:23] Balthasar|V20: has joined #RubyOnRails
[20:53:47] rakm: has joined #RubyOnRails
[20:56:48] Slogger: mordof: did you figure anything out?
[20:57:08] mordof: Slogger: it's not the fault of create_node internally - i know that much
[20:57:13] mordof: Slogger: but no, i haven't solved it
[20:58:09] mordof: Slogger: i replaced create_node with a Node.create, and then updating the agency/client/presence with the node id appropriately. still gets a stack level too deep
[20:58:21] Slogger: You did check that into the double save effect?
[20:59:00] mordof: agency does get saved twice, yes - but that shouldn't cause a stack level too deep
[20:59:18] mordof: it would simply update node twice as well, and then be done
[20:59:27] mordof: or at least, that's what *should* happen
[21:00:20] mordof: ACTION removes both inverse_of calls to see if they're causing problems
[21:00:57] mordof: still happens
[21:03:08] Slogger: This is a tangent, but I don't really get Node.
[21:03:58] mordof: Slogger: yeah.. it's strange. basically here's what we ran into. Agency/Client/Presence are three levels of a hierarchy. the app views have features that exist at certain levels
[21:04:04] mordof: we started writing code that could exist at more than one level
[21:04:12] mordof: it became a royal pain to customize/abstract out that layer
[21:04:15] mordof: so we made Node
[21:04:27] mordof: it's an ambiguous object that reflects/knows about each layer
[21:04:40] Slogger: Why does it have_one without being polymorphic?
[21:04:43] mordof: so we can write code to work with the Node that the person is looking at, and the code doesn't need to care what level it is
[21:05:04] mordof: not sure what that would look like
[21:05:40] mordof: the has_one's aren't always populated. in our actual code we have a .owner, which isn't a relationship - but a method call - to give us which one we're related to
[21:05:47] Slogger: http://guides.rubyonrails.org/association_basics.html#polymorphic-associations
[21:06:16] mordof: pretty sure we looked into this at the time, but thought it wouldn't work out.. checking again
[21:06:21] Slogger: So in a polymorphic the related id and class name would be stored in node, and the other models wouldn't have node_id
[21:06:39] Slogger: It's a tangent
[21:07:25] blackmesa: has joined #RubyOnRails
[21:07:44] mordof: Slogger: the annoying part about all of this, is if i comment out the has_one's inside node.rb (which doesn't break *anything* inside agency.rb or the others) - the stack level too deep goes away
[21:07:58] mordof: something to do with the fact that the has_one's are registered is making this an issue
[21:08:48] ForeignBiscuit: has joined #RubyOnRails
[21:10:42] mordof: i don't see how that makes any sense - when all i'm doing is saving a node - which has no hooks/callbacks to propagate a save back to the agency/client/presence. a has_one should only update the other record if the id gets changed
[21:11:30] mordof: unless there's a bug with has_one, and it's triggering a save every time
[21:11:33] Slogger: Has one may try to update the related id.
[21:11:49] Slogger: But I'd think it would be case-by-case
[21:11:52] blackmesa: has joined #RubyOnRails
[21:14:05] mordof: oh, i'm testing against the wrong 4.x version
[21:14:11] mordof: we were on 4.1.5, not 4.2.6
[21:14:48] uksio: has joined #RubyOnRails
[21:14:54] mordof: ... that still blows up
[21:15:00] mordof: ok i have to go -.-
[21:15:04] mordof: Slogger: thanks for all the help
[21:18:03] gusrub: has joined #RubyOnRails
[21:27:31] arBmind: has joined #RubyOnRails
[21:32:27] workmad3: has joined #RubyOnRails
[21:40:49] duderonomy: has joined #RubyOnRails
[21:45:37] Slogger: has left #RubyOnRails: ()
[21:45:40] Slogger: has joined #RubyOnRails
[21:48:16] gusrub: has joined #RubyOnRails
[21:52:42] auv: has joined #RubyOnRails
[22:01:42] fernandomm: has joined #RubyOnRails
[22:10:43] xco: has joined #RubyOnRails
[22:11:28] xco: has joined #RubyOnRails
[22:12:18] xco: has joined #RubyOnRails
[22:14:07] xco: has joined #RubyOnRails
[22:15:29] xco: has joined #RubyOnRails
[22:22:43] beauby: has joined #RubyOnRails
[22:27:44] akshat: has joined #RubyOnRails
[22:33:09] Fire-Dragon-DoL: mhh, is an expected behavior that when `create` fails because of validation error, to _still_ return the object instead of nil?
[22:36:45] kristofferR: has joined #RubyOnRails
[22:37:23] xco: has joined #RubyOnRails
[22:37:56] baweaver: yes, because object.errors
[22:54:21] quazimodo: has joined #RubyOnRails
[23:06:09] quirkycoders: has joined #RubyOnRails
[23:09:42] gusrub: has joined #RubyOnRails
[23:13:44] eric_firth: has joined #RubyOnRails
[23:16:43] Rodya_: has joined #RubyOnRails
[23:18:39] eric_firth: question about the Attributes API. I have a column thats a JSON hash, I want to do computation based on the values of that hash. I thought this was what the attributes API was for, my column is called plan. That I could do model.plan.success? by making the plan column cast to a Plan class...am i misinterpretting it?
[23:20:13] choke: has joined #RubyOnRails
[23:23:47] gusrub: has joined #RubyOnRails
[23:49:59] Rodya_: has joined #RubyOnRails
[23:58:33] romeoh: has joined #RubyOnRails