#RubyOnRails - 18 March 2018
« Back 1 day Forward 1 day »
[01:17:33] ponzii: When I switch some env variables in my .bashrc on my production server and restart my Rails app/Puma the app still seems to be using the old env variables. Why is this?
[01:40:09] ponzii: Omnilord: Is there any way of seeing which ENV variables Rails is using? Are ENV variables cached?
[01:41:17] ponzii: Omnilord: I checked the ENV vars with echo before restarting Puma so this shouldn't have happened.
[01:43:29] ponzii: Omnilord: Will Rails console give me Rails ENV vars or just read `env` from the shell?
[01:44:33] Omnilord: If you use a Rails console, you should be able to do a 'puts ENV.inspect' and see what is set.
[01:47:12] ponzii: Omnilord: Out of luck with Rails console. I'm running 5.2.0 RC1 and `bin/rail c` gives me an Active Record connection specification error.
[02:10:29] Omnilord: ponzii, I don't know if you would be able to get an output from rails server if you have an exception preventing the console from running.
[02:11:27] ponzii: Omnilord: I fixed it. Was using uri in database.yaml without specifying an adapter separately.
[02:12:21] ponzii: Omnilord: puts ENV.inspect just gives me the output of `env` in a Linux shell. Somehow my app seems to be getting different ENV variable values.
[02:13:56] ponzii: Omnilord: I have alternative ENV vars in .bashrc commented out but I've restarted the app since they were last used and they don't show up in `puts ENV.inspect`. Weird.
[02:15:01] ponzii: Omnilord: These particular ENV vars are email addresses for mailouts. Somehow Rails is mailing out to ENV vars which are commented out in my .bashrc.
[11:17:00] xhoy: hi there, i have a new object, lets call it user, user is involed in almost all other models in my db, it createds stuff, it updates stuff, it deletest stuff, it does all kind of stuff, but there is no easy why of know what a user *all* did, since the actions are scadderd all over the place, should i reverse the relation and create a N:M model in the middle?
[19:00:04] fox_mulder_cp: hi. i try to create alias for method in my plain ruby class, but have a exeption that no method defined. where i have a mistake?
[19:23:00] IanMalcolm: if I have an association like Foo has_many :bars, is there any way to do something like `Foo.new(bars: [1,2])`?
[19:23:19] IanMalcolm: i.e. passing a list of ids for the association instead of a list of AR objects
[19:48:51] das3in: Hi everyone, I have a poro that listens to a serial port and has some functions to respond to that data. I want to be able to make a get request to call some of those functions (like "/average" => controller#average)
[19:50:33] das3in: I thought about writing a "start" endpoint that does something like "@bot = Service.new" but then I'm not sure how i'd access the same instance of @bot from other controller functions
[19:54:49] IanMalcolm: fox_mulder_cp: thanks. Another question: is this better than querying and passing the list of AR objects? Like `foos = Foo.where(baz: 5); Bar.new(foos: foos)`
[19:55:36] IanMalcolm: and I'm trying to see if doing `Foo.where(baz: 5).pluck(:id)` and passing that is better