« Back to channel list

#RubyOnRails - 20 April 2018

« Back 1 day Forward 1 day »
[00:23:35] schneider: has joined #RubyOnRails
[00:31:11] kurko_: has joined #RubyOnRails
[00:34:52] groktar: has joined #RubyOnRails
[00:36:53] cagomez_: has joined #RubyOnRails
[00:38:34] chouhoulis: has joined #RubyOnRails
[00:47:32] duderonomy: has joined #RubyOnRails
[00:54:30] alfiemax: has joined #RubyOnRails
[00:56:25] JJonah: what is the correct way to instantiate an object in rails that can be reused across multiple requests? that is, it can be created during application bootup, but then needs to be used by a controller?
[00:56:35] Radar: JJonah: What does this object do?
[00:57:52] JJonah: Radar: it verifies security requirements, but the context isn't necessarily relevant for my question
[00:59:25] Radar: JJonah: Typically, a constant defined in `config/initializers/some_file.rb` would be the way to do that.
[00:59:37] JJonah: Radar: Think something like at bootup: `@security = Security.new(ENV['blah], etc)`. Then in an authenticate controller: `@security.validate(param1, param2)`
[01:01:08] JJonah: Wasn't clear to me if that belonged in an initializer or not
[01:02:29] Radar: Well, it's a good way to only initialize an object once and then the constant will make it available across your app.
[01:03:36] JJonah: Radar: Yeah, looks like that's the correct answer for what I want: https://stackoverflow.com/questions/6517914/how-to-create-an-app-wide-object (according to the accepted answer, anyway)
[01:19:04] _3dwardsharp: has joined #RubyOnRails
[01:25:16] cagomez_: has joined #RubyOnRails
[01:45:34] starseed00: has joined #RubyOnRails
[01:45:59] starseed00: How do you all organise your authenticated, unathenticated, pages?
[01:46:31] starseed00: Any namespaces? Any parent controllers that they all inherit from? Naming strategies?
[02:02:41] cschneid_: has joined #RubyOnRails
[02:03:32] Radar: starseed00: I usually have authenticated / unauthenticated controllers in the same directory. Authenticated controllers inherit from a common controller.
[02:04:17] Radar: starseed00: In one app, I've got the concept of an "account" that users belong to, and I inherit from Accounts::BaseController: https://github.com/radar/twist/blob/asciidoc/app/controllers/accounts/books_controller.rb#L2
[02:05:11] fragamus: has joined #RubyOnRails
[02:08:19] starseed00: Radar: Thanks, that's along the lines of what I am thinking too
[02:11:04] alfiemax: has joined #RubyOnRails
[02:57:52] kn-928: has joined #RubyOnRails
[03:34:13] JJonah: If your rails controller references `ENV['some-var']`, and the value of it changes while the app is running at 10pm, will a request served at 10:01pm show the new value, or the value at the time the app was started? That is, does rails cache environment values, or reread them on every request?
[03:37:16] orbyt_: has joined #RubyOnRails
[03:56:15] Radar: It depends. Is that referenced at the top level of an initalizer as we talked about?
[03:56:26] Radar: If so, then that environment variable will only be read once while the application is starting up
[04:15:29] JJonah: Radar: This one is in a controller, so will it be reread on each request?
[04:27:42] Radar: JJonah: yes if it's inside an action it will be re-read on each request
[04:27:46] Radar: If it is not inside an action it will only be read one
[04:30:45] orbyt_: has joined #RubyOnRails
[04:36:19] reber: has joined #RubyOnRails
[05:01:26] LateralO1: has joined #RubyOnRails
[05:01:40] _aeris_: has joined #RubyOnRails
[05:04:48] jnollette: has joined #RubyOnRails
[05:08:37] tejasmanohar: has joined #RubyOnRails
[05:16:23] cschneid_: has joined #RubyOnRails
[05:27:25] linetrace: has joined #RubyOnRails
[05:32:18] srinidhi: has joined #RubyOnRails
[05:34:32] kapil___: has joined #RubyOnRails
[05:36:06] sidx64: has joined #RubyOnRails
[05:47:13] sidx64: has joined #RubyOnRails
[05:47:18] timdotrb: has joined #RubyOnRails
[06:04:11] apeiros: has joined #RubyOnRails
[06:27:53] mauro1254: has joined #RubyOnRails
[06:29:42] sevenseacat: has joined #RubyOnRails
[06:50:07] ariejan: has joined #RubyOnRails
[06:56:00] _aeris_: has joined #RubyOnRails
[07:00:31] schneider: has joined #RubyOnRails
[07:01:13] cam27: has joined #RubyOnRails
[07:01:54] sameerynho: has joined #RubyOnRails
[07:02:16] cam27: has joined #RubyOnRails
[07:03:31] dionysus69: has joined #RubyOnRails
[07:12:26] sidx64_: has joined #RubyOnRails
[07:16:43] sidx64: has joined #RubyOnRails
[07:20:54] LateralO1: has joined #RubyOnRails
[07:53:35] marr: has joined #RubyOnRails
[07:54:09] timdotrb: has joined #RubyOnRails
[07:54:54] timdotrb: has joined #RubyOnRails
[07:57:18] srinidhi: has joined #RubyOnRails
[08:00:49] Ergo: has joined #RubyOnRails
[08:02:09] ariejan: has joined #RubyOnRails
[08:06:00] defsdoor: has joined #RubyOnRails
[08:06:51] mikecmpbll: has joined #RubyOnRails
[08:19:29] schneider: has joined #RubyOnRails
[08:21:11] trautwein: has joined #RubyOnRails
[08:48:51] ur5us: has joined #RubyOnRails
[09:03:05] ariejan: has joined #RubyOnRails
[09:10:48] sidx64: has joined #RubyOnRails
[09:20:31] sidx64: has joined #RubyOnRails
[09:26:44] sevenseacat: has joined #RubyOnRails
[09:31:09] ur5us: has joined #RubyOnRails
[09:31:43] DrYockel: has joined #RubyOnRails
[09:42:26] dionysus69: where are activeadmin javascript files saved at? cant find them systemwide -.-
[09:45:08] ellcs: has joined #RubyOnRails
[09:45:31] tbuehlmann: here? https://github.com/activeadmin/activeadmin/tree/v1.2.1/app/assets/javascripts/active_admin
[09:49:42] Fernando-Basso: has joined #RubyOnRails
[09:57:38] MrCrackPotBuilde: has joined #RubyOnRails
[09:57:57] dionysus69: ok thanks :)
[10:05:05] Fernando-Basso: has joined #RubyOnRails
[10:06:59] sidx64: has joined #RubyOnRails
[10:20:54] apeiros: has joined #RubyOnRails
[10:36:54] hfp_work: has joined #RubyOnRails
[10:43:12] JDeen: has joined #RubyOnRails
[10:46:14] JDeen: I am upgrading a Rails 3 project to Rails 5. In the process, I am recieving an error which states 'NoMethodError: undefined method `arity' for {:class_name=>"Group"}:Hash' for some thing like `belongs_to :default_group, class_name: 'Group'`. Could it be an error in the upgrade? How can I approach to debug the error?
[10:46:24] sidx64: has joined #RubyOnRails
[10:48:06] JJonah: Radar: thanks
[10:51:01] LateralO1: has joined #RubyOnRails
[10:52:37] dang`r`us: has joined #RubyOnRails
[10:53:07] dang`r`us: hey there, it seems I cannot do a db:drop while rails is running and has made at least one query. I'm assuming this is because of persistent connections, which make of course sense for production, but can I disable them for development?
[11:00:49] tbuehlmann: dang`r`us: you could stop all processes or run ActiveRecord::Base.connection_pool.disconnect!
[11:01:18] dang`r`us: tbuehlmann, so there is no config setting?
[11:01:33] dang`r`us: unrelated, when I do .create and it results in a ROLLBACK, can I somehow see the reason for that?
[11:03:06] tbuehlmann: dang`r`us: .create returns the model object, on which you can call #errors
[11:03:20] tbuehlmann: and no, there's no setting for "don't use the database"
[11:03:34] dang`r`us: errors: thx
[11:03:39] dang`r`us: setting: i did not ask for that setting
[11:04:03] dang`r`us: I wanted to know if I can disable persistent connections, like https://docs.djangoproject.com/en/2.0/ref/databases/#persistent-connections in "that other web framework"
[11:04:23] fragamus: has joined #RubyOnRails
[11:04:45] dang`r`us: I mean, -if- my assumption is true.
[11:04:45] tbuehlmann: I don't know of such setting either
[11:04:59] dang`r`us: I just observe after at least one db query I cannot do a db:drop anymore
[11:05:08] dang`r`us: ok, I guess I'll try to disconnect via AR
[11:05:53] tbuehlmann: yes, when doing anything with activerecord that's hitting the database, that connection is bound to the current thread
[11:05:53] dang`r`us: is there a generic wrapper for object creation so I get an exception or sth when create fails, and see the errors?
[11:06:16] tbuehlmann: you can call .create! instead of .create which will raise an exception in case of validation failures
[11:10:13] MrCrackPotBuilde: has joined #RubyOnRails
[11:12:32] duderonomy: has joined #RubyOnRails
[11:15:47] schneider: has joined #RubyOnRails
[11:18:45] dang`r`us: ah, cool, thanks!
[11:29:32] halbbalda: has left #RubyOnRails: ()
[11:32:49] Cavallari: has joined #RubyOnRails
[11:33:14] ellcs: has joined #RubyOnRails
[11:48:41] ariejan: has joined #RubyOnRails
[12:02:03] kn-928: has joined #RubyOnRails
[12:06:49] kn-928: has joined #RubyOnRails
[12:08:09] fragamus: has joined #RubyOnRails
[12:13:48] MrCrackPotBuilde: has joined #RubyOnRails
[12:14:41] MrCrackPotBuilde: has joined #RubyOnRails
[12:15:53] MrCrackPotBuilde: has joined #RubyOnRails
[12:24:54] kn-928: has left #RubyOnRails: ("WeeChat 2.1")
[12:43:35] kurko_: has joined #RubyOnRails
[13:10:46] ellcs: has joined #RubyOnRails
[13:11:59] kurko_: has joined #RubyOnRails
[13:22:13] schneider: has joined #RubyOnRails
[13:23:05] rfoust: has joined #RubyOnRails
[13:27:53] chocoelho: has joined #RubyOnRails
[13:28:21] duderonomy: has joined #RubyOnRails
[13:29:18] Cavallari: has joined #RubyOnRails
[13:40:32] arooni: has joined #RubyOnRails
[13:45:58] roshanavand: has joined #RubyOnRails
[13:48:36] catbusters: has joined #RubyOnRails
[13:51:13] harrycs: has joined #RubyOnRails
[14:01:43] kurko__: has joined #RubyOnRails
[14:02:26] gil_: has joined #RubyOnRails
[14:09:00] iamdevnul: has joined #RubyOnRails
[14:11:30] kapil___: has joined #RubyOnRails
[14:11:45] auv: has joined #RubyOnRails
[14:11:59] Lloyd: has joined #RubyOnRails
[14:15:24] Scient: has joined #RubyOnRails
[14:27:39] apeiros: has joined #RubyOnRails
[14:29:37] hellekin: has joined #RubyOnRails
[14:30:29] gil_: has joined #RubyOnRails
[14:32:29] jottr: has joined #RubyOnRails
[14:35:01] workmad3: has joined #RubyOnRails
[14:38:04] tycoon177: has joined #RubyOnRails
[14:38:41] cagomez: if I define `has_many :items` on Users, do I need to define `has_one :user` on Item?
[14:38:50] cagomez: or is the latter implied?
[14:39:19] kurko__: It's not implied. If you want to use `item.user`, you have to define. If you don't need to use `item.user`, you don't need to define it.
[14:54:35] apparition: has joined #RubyOnRails
[15:01:18] Vegetable: has joined #RubyOnRails
[15:08:42] SteenJobs: has joined #RubyOnRails
[15:15:21] chouhoulis: has joined #RubyOnRails
[15:18:03] GeorgesLeYeti: has joined #RubyOnRails
[15:19:53] GeorgesLeYeti: I have User which have has_many Events. Each events has a start_at (datetime) and end_at (datetime)
[15:20:20] GeorgesLeYeti: I have a Project also with a start_at and end_at.
[15:21:00] GeorgesLeYeti: And I want to find all users wich don't have any events between the start_at and the end_at of my project
[15:23:45] Arkentias: has joined #RubyOnRails
[15:28:01] Vegetable: some databases have within() functions that support dates
[15:31:12] duderonomy: has joined #RubyOnRails
[15:32:02] zacts: has joined #RubyOnRails
[15:37:29] Fernando-Basso: has joined #RubyOnRails
[15:41:02] GeorgesLeYeti: I'm using postgres
[15:49:56] cagomez_: has joined #RubyOnRails
[15:54:20] jcarl43: has joined #RubyOnRails
[15:55:23] nogic: has joined #RubyOnRails
[15:58:27] jcarl43: has joined #RubyOnRails
[16:03:12] [Butch]: has joined #RubyOnRails
[16:03:56] darkhanb: has joined #RubyOnRails
[16:08:15] orbyt_: has joined #RubyOnRails
[16:10:11] krawchyk: has joined #RubyOnRails
[16:10:53] dionysus69: has joined #RubyOnRails
[16:14:36] Puffball: has joined #RubyOnRails
[16:15:27] SteenJobs: has joined #RubyOnRails
[16:16:00] one_zero: has joined #RubyOnRails
[16:20:48] cam27: has joined #RubyOnRails
[16:29:12] orbyt_: has joined #RubyOnRails
[16:35:02] groktar: has joined #RubyOnRails
[16:57:29] dionysus69: has joined #RubyOnRails
[16:57:49] groktar: Hi, I need a way to prefix the routes for activestorage. /rails/active_storage/stuff would become /thingy/rails/active_storage/. Seems like I won't be able to do that without modifying https://github.com/rails/rails/blob/master/activestorage/config/routes.rb. I'm wondering if there's an alternative to modifying the gem and if not, whether a patch would be welcomed. Maybe something similar to the way the action cable mount path is configured.
[17:00:27] ams__: has joined #RubyOnRails
[17:03:37] timdotrb: has joined #RubyOnRails
[17:06:54] schneider: has joined #RubyOnRails
[17:10:11] JDeen: I am upgrading a Rails 3 project to Rails 5. In the process, I am recieving an error which states 'NoMethodError: undefined method `arity' for {:class_name=>"Group"}:Hash' for some thing like `belongs_to :default_group, class_name: 'Group'`. Could it be an error in the upgrade? How can I approach to debug the error?
[17:13:58] kurko__: jdeen rule #1: don't go from 3 to 5. Go from 3 to 3.1, to 3.2, then 4.0, then 4.1, then 4.2, then 5, then 5.1, then 5.2.
[17:15:28] kurko__: jdeen it is not possible to do a correct assessment without knowing the version you were and which one you're updating to. Generally, the changelogs and migration docs will not include changes as long as from 3 to 5.
[17:16:39] Dimik: has joined #RubyOnRails
[17:17:10] Dimik: is anybody else having a problem with rails generate devise:install in rails 5.2.0 devise 4.4.3
[17:44:08] harrycs: has joined #RubyOnRails
[17:55:37] harrycs: has joined #RubyOnRails
[17:59:31] dgsan: I have methods to use in query chaining that sometimes don't change the query. When they don't change it what are they supposed to return? Self is wrong and resets the query chain.
[18:01:41] harrycs: has joined #RubyOnRails
[18:02:58] dgsan: (From what I can tell you just end the method with `all` if you haven't changed the query?)
[18:05:42] harrycs: has joined #RubyOnRails
[18:13:36] IRCtoo: has joined #RubyOnRails
[18:19:42] harrycs: has joined #RubyOnRails
[18:21:39] harrycs: has joined #RubyOnRails
[18:23:41] harrycs: has joined #RubyOnRails
[18:24:18] tdy: has joined #RubyOnRails
[18:25:39] harrycs: has joined #RubyOnRails
[18:25:56] Dimik: devise isn't installing with rails wtf bbq
[18:27:38] harrycs: has joined #RubyOnRails
[18:28:03] Bacta: has joined #RubyOnRails
[18:28:09] Bacta: Anyone use resque-web?
[18:33:39] harrycs: has joined #RubyOnRails
[18:35:38] harrycs: has joined #RubyOnRails
[18:37:38] harrycs: has joined #RubyOnRails
[18:37:55] chouhoulis: has joined #RubyOnRails
[18:39:38] harrycs: has joined #RubyOnRails
[18:41:35] Cavallari: has joined #RubyOnRails
[18:41:38] harrycs: has joined #RubyOnRails
[18:43:39] harrycs: has joined #RubyOnRails
[18:45:39] harrycs: has joined #RubyOnRails
[18:46:14] JDeen: kurko__: thanks... i know its hard to say... ya change logs are hard to follow up... i think the best would be to go stepwise.
[18:47:40] harrycs: has joined #RubyOnRails
[18:48:54] kurko__: jdeen Absolutely. The best decision is to go stepwise.
[18:49:38] harrycs: has joined #RubyOnRails
[18:50:04] IRCtoo: in development mode, I have changed my database.yml location of the sqlite database file. I stopped rails server and spring. When I rerun rails server and try to access anything it says that the <old file location> not found. In other words, it isn't using my new file location specified in database.yml. Anyone know a solution?
[18:50:57] kurko__: IRCtoo I think you need to run `rake db:create`
[18:51:37] IRCtoo: kurko__ not sure if it matters, but I copied the development.sqlite3 file from the old location to the new location and deleted the file from the old location.
[18:51:38] harrycs: has joined #RubyOnRails
[18:51:58] LateralO1: has joined #RubyOnRails
[18:52:54] kurko__: IRCtoo are you running spring? Does `spring status` show anything?
[18:54:16] IRCtoo: kurko__ spring is running. very interesting, there must be something behind the scenes when running rails db:migrate because that fixed it. it said that the file already exists, but after running that command, the rails console and server now use the new location (as specified in database.yml) rather than the old location. Note that the db:create didn't actually create anything, as my
[18:54:16] IRCtoo: data is still all there now. Thanks!
[18:55:16] kurko__: IRCtoo ugh, I dislike spring because of that, it caches stuff it shouldn't. run `spring stop` and it should fix those temporary issues.
[18:57:39] harrycs: has joined #RubyOnRails
[18:59:38] harrycs: has joined #RubyOnRails
[19:01:40] harrycs: has joined #RubyOnRails
[19:08:17] Saukk: has joined #RubyOnRails
[19:09:39] harrycs: has joined #RubyOnRails
[19:11:39] harrycs: has joined #RubyOnRails
[19:13:42] harrycs: has joined #RubyOnRails
[19:15:41] harrycs: has joined #RubyOnRails
[19:17:40] harrycs: has joined #RubyOnRails
[19:19:38] harrycs: has joined #RubyOnRails
[19:21:40] harrycs: has joined #RubyOnRails
[19:25:37] jottr: has joined #RubyOnRails
[19:26:18] sidx64: has joined #RubyOnRails
[19:34:58] randohinn: has joined #RubyOnRails
[19:36:10] randohinn: I need a look on https://paste.ubuntu.com/p/23JKrRCZw3/
[19:37:13] randohinn: Tells me undefined method `[]' for nil:NilClass Couldn't create database for nil Completed 500 Internal Server Error in 427ms NoMethodError (undefined method `[]' for nil:NilClass):
[19:43:35] sameerynho: has joined #RubyOnRails
[19:45:09] fragamus: has joined #RubyOnRails
[19:47:48] randohinn: Tried ActiveRecord::Tasks::DatabaseTasks.database_configuration = conn_config already
[19:49:43] sidx64: has joined #RubyOnRails
[19:56:13] cagomez_: has joined #RubyOnRails
[19:57:20] alfiemax: has joined #RubyOnRails
[19:58:48] randohinn: puts conn_config gives me {:adapter=>"postgresql", :encoding=>"unicode", :pool=>5, :database=>"6d69e498-4542-42c2-87c1-0e10f3b49f21", :host=>"localhost"}
[19:59:34] duderonomy: has joined #RubyOnRails
[20:03:05] cagomez_: has joined #RubyOnRails
[20:12:13] randohinn: https://stackoverflow.com/questions/49949072/activerecordtasksdatabasetasks-create-undefined-method-for-nilnilclass
[20:19:20] alfiemax: has joined #RubyOnRails
[20:36:25] alfiemax: has joined #RubyOnRails
[20:40:03] blitz: has joined #RubyOnRails
[21:00:58] fox_mulder_cp: randohinn rails db:create && rails db:migrate
[21:01:28] fox_mulder_cp: or create it manually, if database user can't have create/destrooy permissions
[21:01:41] cagomez_: has joined #RubyOnRails
[21:17:41] Cavallari: has joined #RubyOnRails
[21:19:16] Cavallari1: has joined #RubyOnRails
[21:22:16] mikecmpbll: has joined #RubyOnRails
[21:26:10] srinidhi: has joined #RubyOnRails
[21:32:58] dionysus69: has joined #RubyOnRails
[21:38:44] tdy: has joined #RubyOnRails
[21:43:18] cagomez_: has joined #RubyOnRails
[21:48:26] Trevoke`: has joined #RubyOnRails
[21:54:01] kevinburke: has joined #RubyOnRails
[21:54:06] kevinburke: is there a way to instruct Rails to avoid loading app/controllers when I start the app?
[21:54:24] kevinburke: it seems like there might be a significant performance win if all I am doing is running tests for a model, for example.
[21:56:21] cagomez_: has joined #RubyOnRails
[21:57:16] cagomez_: has joined #RubyOnRails
[21:59:39] cagomez_: has joined #RubyOnRails
[22:00:25] cagomez_: has joined #RubyOnRails
[22:01:22] Trevoke`: Hi all. So it turns out scopes will always do a database query, even if the data's already loaded in memory, which is faintly frustrating...
[22:01:36] fox_mulder_cp: kevinburke: you can manually select what test scope want use - controllers, model..
[22:01:47] fox_mulder_cp: in described in examples
[22:01:59] Trevoke`: I admit I don't really have a question here, other than.. How hard is it to transform a scope into a Ruby filter of sorts?
[22:04:14] kevinburke: fox_mulder_cp: apologies, I'm searching for "rails test scopes" or "rails test scope models only" and the results I'm reading are not very good
[22:05:08] fox_mulder_cp: Trevoke`: http://guides.rubyonrails.org/active_record_querying.html#scopes ?
[22:06:21] dviola: has joined #RubyOnRails
[22:06:29] Trevoke`: fox_mulder_cp: I'm looking for "dog.owners.male" to do an SQL query if I don't have the data and to just filter the existing data if I have it in memory
[22:06:30] fox_mulder_cp: rspec spec/models # All specs in the models directory
[22:06:30] fox_mulder_cp: rspec spec/models/a_model_spec.rb # All specs in the some_model model spec
[22:19:58] rfoust: has joined #RubyOnRails
[22:22:23] kapil___: has joined #RubyOnRails
[22:27:51] bananaboydean: has joined #RubyOnRails
[22:29:31] bananaboydean: Has anyone run into issues with Postgres CVE-2018-1058? pg_dump & other postgres commands remove the search_path from an open connection.
[22:29:44] bananaboydean: This is mostly(only?) an issue when using pg_bouncer.
[22:30:41] dviola: has joined #RubyOnRails
[22:41:01] Technodrome: has joined #RubyOnRails
[22:51:38] Fernando-Basso: has joined #RubyOnRails
[22:53:09] mikecmpbll: has joined #RubyOnRails
[23:09:42] srinidhi: has joined #RubyOnRails
[23:41:37] duderonomy: has joined #RubyOnRails