« Back to channel list

#RubyOnRails - 09 November 2018

« Back 1 day Forward 1 day »
[00:04:48] chouhoulis: has joined #RubyOnRails
[00:10:12] chouhoulis: has joined #RubyOnRails
[00:12:53] sevenseacat: has joined #RubyOnRails
[00:13:19] ivanskie: has joined #RubyOnRails
[00:15:35] chouhoulis: has joined #RubyOnRails
[00:17:19] mr-spoon: has joined #RubyOnRails
[00:20:59] chouhoulis: has joined #RubyOnRails
[00:26:24] chouhoulis: has joined #RubyOnRails
[00:30:40] ellcs: has joined #RubyOnRails
[00:31:45] chouhoulis: has joined #RubyOnRails
[00:37:05] chouhoulis: has joined #RubyOnRails
[00:42:34] chouhoulis: has joined #RubyOnRails
[00:48:09] chouhoulis: has joined #RubyOnRails
[00:50:14] hnanon_: has joined #RubyOnRails
[00:53:24] chouhoulis: has joined #RubyOnRails
[00:55:49] cxl: Hey so I have a hard time deciding whether a method should go on the model on in the controller. Is there a rule of thumb I could follow when in doubt?
[00:56:07] cxl: s/on in/or in
[00:56:29] eckhardt_: has joined #RubyOnRails
[00:57:13] orbyt_: has joined #RubyOnRails
[00:58:37] chouhoulis: has joined #RubyOnRails
[01:04:07] chouhoulis: has joined #RubyOnRails
[01:05:55] blackmesa: has joined #RubyOnRails
[01:09:25] chouhoulis: has joined #RubyOnRails
[01:14:54] chouhoulis: has joined #RubyOnRails
[01:18:55] mr-spoon: has joined #RubyOnRails
[01:20:16] chouhoulis: has joined #RubyOnRails
[01:25:40] chouhoulis: has joined #RubyOnRails
[01:26:42] Radar: cxl: what does this method do?
[01:26:51] Radar: cxl: Could you gist it?
[01:27:14] Radar: cxl: My rule of thumb is that if it has to work with something from the request / response it goes in the controller. If it is working more with information from the model, then it should go in the model.
[01:28:05] sevenseacat: good guideline
[01:31:06] chouhoulis: has joined #RubyOnRails
[01:36:26] chouhoulis: has joined #RubyOnRails
[01:46:04] jetchisel: has joined #RubyOnRails
[01:47:15] chouhoulis: has joined #RubyOnRails
[01:49:08] jetchisel: has joined #RubyOnRails
[01:50:15] mangold: has joined #RubyOnRails
[01:52:34] chouhoulis: has joined #RubyOnRails
[01:53:59] jetchisel: has joined #RubyOnRails
[01:57:11] jetchisel: has joined #RubyOnRails
[01:57:58] chouhoulis: has joined #RubyOnRails
[02:01:09] jetchisel: has joined #RubyOnRails
[02:02:19] cxl: Radar: in that case, it was this method: https://github.com/mhartl/sample_app_3rd_edition/blob/master/app/models/user.rb#L81-L86 and I wasn't sure whether it should go in the controller or the model.
[02:03:24] chouhoulis: has joined #RubyOnRails
[02:03:38] cxl: so it uses the user id from the request in a way, since users are identified with a cookie
[02:08:52] chouhoulis: has joined #RubyOnRails
[02:09:36] jetchisel: has joined #RubyOnRails
[02:12:00] elcontrastador: has joined #RubyOnRails
[02:14:10] chouhoulis: has joined #RubyOnRails
[02:17:16] elcontrastador: greetings, getting back to rails after years. Researching custom validator classes...all clear to me except for where to physically locate the classes that are included in the search path. Do I just put them in <prj_root>/lib ?
[02:19:33] chouhoulis: has joined #RubyOnRails
[02:24:57] chouhoulis: has joined #RubyOnRails
[02:26:36] ivanskie: has joined #RubyOnRails
[02:27:04] DTZUZO: has joined #RubyOnRails
[02:35:19] Saukk: has joined #RubyOnRails
[02:35:39] chouhoulis: has joined #RubyOnRails
[02:38:03] bambanx: has joined #RubyOnRails
[02:41:06] chouhoulis: has joined #RubyOnRails
[02:43:06] bambanxx: has joined #RubyOnRails
[02:46:28] chouhoulis: has joined #RubyOnRails
[02:51:57] chouhoulis: has joined #RubyOnRails
[02:57:17] chouhoulis: has joined #RubyOnRails
[03:01:24] bga57: has joined #RubyOnRails
[03:02:41] chouhoulis: has joined #RubyOnRails
[03:09:09] chouhoulis: has joined #RubyOnRails
[03:15:14] mangold: has joined #RubyOnRails
[03:16:45] gambl0re: has joined #RubyOnRails
[03:31:39] mangold: has joined #RubyOnRails
[03:47:47] darkhanb: has joined #RubyOnRails
[04:09:00] braincrash: has joined #RubyOnRails
[04:19:17] SteenJobs: has joined #RubyOnRails
[04:35:28] kapil____: has joined #RubyOnRails
[04:35:54] za1b1tsu: has joined #RubyOnRails
[05:01:06] davidh38: has joined #RubyOnRails
[05:08:31] Defenestrate: has joined #RubyOnRails
[05:13:12] ivanskie: has joined #RubyOnRails
[05:17:55] CGibsonmm: has joined #RubyOnRails
[05:19:46] CGibsonmm: looking to access the after_create method on devise new user where would I place this? I have seen docs on after_create_sign_up_path but not where to add a method to the devise controller
[05:24:09] mangold: has joined #RubyOnRails
[05:29:03] Defenestrate: has left #RubyOnRails: ("im outskies")
[05:31:18] ChatCodingLab: has joined #RubyOnRails
[05:32:19] oddie: has joined #RubyOnRails
[05:35:16] jackhum: has joined #RubyOnRails
[05:44:18] srinidhi: has joined #RubyOnRails
[05:45:29] tbuehlmann: elcontrastador: app/validators is a common place and you wouldn't need to adapt any load paths
[06:23:35] mangold: has joined #RubyOnRails
[06:38:16] reber: has joined #RubyOnRails
[06:41:35] Radar: elcontrastador: I agree with tbuehlmann. They go into app/validators.
[06:41:40] Radar: elcontrastador: Are you using dry-validation by chancE?
[06:42:51] Radar: cgibsonmm: You could do an after_create in your User model.
[06:43:28] CGibsonmm: Yeah, Finally got it working Thank you
[06:44:48] ivanskie: has joined #RubyOnRails
[06:55:47] CGibsonmm: has joined #RubyOnRails
[07:17:59] jackhum: has joined #RubyOnRails
[07:20:40] conta: has joined #RubyOnRails
[07:39:15] roshanavand: has joined #RubyOnRails
[07:44:16] conta: has joined #RubyOnRails
[07:50:54] davidh38: has joined #RubyOnRails
[08:19:10] apparition: has joined #RubyOnRails
[08:25:24] mangold: has joined #RubyOnRails
[08:25:43] davidh38: has joined #RubyOnRails
[08:33:49] srinidhi: has joined #RubyOnRails
[08:37:49] jackhum: has joined #RubyOnRails
[08:43:50] MoritaShinobu: has joined #RubyOnRails
[08:52:12] roshanavand1: has joined #RubyOnRails
[08:52:56] JamieD: has joined #RubyOnRails
[08:59:53] Ergo: has joined #RubyOnRails
[09:00:12] blackmesa: has joined #RubyOnRails
[09:03:14] dionysus69: This doesn't work in application.rb config.require_master_key = false, I want to disable credentials decryption while in build step of the deployment, assets precompilation shouldn't require master keyt
[09:03:29] dionysus69: so is this a bug?
[09:06:04] tbuehlmann: configuration from config/environments/*.rb take precedence over config/application.rb
[09:07:01] dionysus69: oh thanks tbuehlmann, now I get it, I didn't know it was explicitly declared inside environment/production.rb
[09:09:59] davidh38: has joined #RubyOnRails
[09:17:41] tdy: has joined #RubyOnRails
[09:18:16] davidh38: has joined #RubyOnRails
[09:32:38] blackmesa: has joined #RubyOnRails
[09:38:37] davidh38: has joined #RubyOnRails
[09:45:41] reber__: has joined #RubyOnRails
[10:01:13] jetchisel: has joined #RubyOnRails
[10:06:58] hays_: has joined #RubyOnRails
[10:14:03] roshanavand: has joined #RubyOnRails
[10:23:15] conta: has joined #RubyOnRails
[10:54:42] davidh38: has joined #RubyOnRails
[10:56:10] tdy: has joined #RubyOnRails
[10:59:35] Guest53511: has joined #RubyOnRails
[11:05:05] davidh38: has joined #RubyOnRails
[11:19:17] conta: has joined #RubyOnRails
[11:34:18] kapil____: has joined #RubyOnRails
[11:44:57] IanMalcolm: has joined #RubyOnRails
[11:54:03] conta1: has joined #RubyOnRails
[12:11:10] lankanmon: has joined #RubyOnRails
[12:33:00] fugee: has joined #RubyOnRails
[12:33:45] fugee: i have all my certificates from sslforfree they expired and i renewed them and replaced the old certs with the newly downloaded certs but my sites still way certificate expired
[12:34:06] fugee: gsub/way/say
[12:35:53] davidh38: has joined #RubyOnRails
[12:47:02] jackhum: has joined #RubyOnRails
[13:09:43] jackhum: has joined #RubyOnRails
[13:20:03] JamieD: has joined #RubyOnRails
[13:20:49] davidh38: has joined #RubyOnRails
[13:34:51] voolik: has joined #RubyOnRails
[14:16:51] davidh38: has joined #RubyOnRails
[14:22:17] apparition: has joined #RubyOnRails
[14:23:07] jackhum: has joined #RubyOnRails
[14:51:02] Saukk: has joined #RubyOnRails
[14:54:03] mikecmpbll: has joined #RubyOnRails
[14:59:24] tdy: has joined #RubyOnRails
[15:01:36] syndikate: Trying to do a redirect_to to the same controller's index action after a PUT request. The PUT request is made using javascript fetch. But unfortunately render does not happen - rails log shows the page being sent with status 200 but at the browser only the 'being redirected' html page is recieved.
[15:02:04] samort7: has joined #RubyOnRails
[15:14:36] davidh38: has joined #RubyOnRails
[15:18:44] beholders_eye: has joined #RubyOnRails
[15:18:56] Guest53511: has joined #RubyOnRails
[15:22:26] whysthatso: has joined #RubyOnRails
[15:55:15] wojnar: has joined #RubyOnRails
[15:58:12] crankharder: syndikate: not sure what 'javascript fetch' is - but you probably shouldn't be redirecting async endpoints. Those endpoints need to return something that your javascript callback can handle. Then you have the JS callback update the browser's location with something like window.location.href = '/some/new/path';
[16:04:34] orbyt_: has joined #RubyOnRails
[16:06:51] davidh38: has joined #RubyOnRails
[16:07:27] chouhoulis: has joined #RubyOnRails
[16:11:09] syndikate: crankharder, https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
[16:11:18] syndikate: But I guess you are right, that's where I must be missing it
[16:13:25] syndikate: has left #RubyOnRails: ("Leaving")
[16:14:56] samort7: If I have a has_many :through relationship between users and books (so that a user can have many books and books can have many users), how would I create a button/form that when clicked, would create a new relationship in my join table (so that a user would be "favoriting" a book)?
[16:15:18] mikecmpb_: has joined #RubyOnRails
[16:15:54] syndikate: has joined #RubyOnRails
[16:16:13] syndikate: Exited by mistake, so if crankharder you said anything I missed it :/
[16:16:34] samort7: I am not sure if I should be using form_tag, form_for, or form_with - and am not sure how the syntax for each of those should be set up
[16:35:08] mikecmpbll: has joined #RubyOnRails
[16:39:02] gambl0re: has joined #RubyOnRails
[16:41:50] mbd2: has joined #RubyOnRails
[16:45:36] hnanon: has joined #RubyOnRails
[16:46:13] hnanon: Should timestamps be stored as integers or datetime?
[16:46:44] hnanon: Is there a preference or convention (besides the created_at and updated_at attributes)
[16:50:50] crankharder: syndikate: yea see that 'then(function(response){...' callback here? https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch -- you want to handle the response object there. Have rails return some json that you can work with in your controller: 'render json: {path: root_path}'
[16:52:35] crankharder: hnanon: look at the tables that rails has created - what are they doing?
[16:53:08] hnanon: crankharder, They're datetimes for created_at and updated_at.
[16:53:42] hnanon: I'm using Stripe and one of their data fields is a timestamp as an integerr.
[16:54:02] hnanon: I wasn't sure if I should convert it or just keep in their native version.
[16:55:10] crankharder: I imagine it's probably best to keep their table the way they recommended
[16:56:12] za1b1tsu: Anyone using prax?
[16:57:43] elcontrastador: radar: I'm not using dry-validation...just googled it. Looks interesting.
[16:57:47] gambl0re: has joined #RubyOnRails
[16:57:58] elcontrastador: tbuehlmann: thank you!
[17:00:46] Dimik: has joined #RubyOnRails
[17:08:04] crankharder: samort7: I would iterate over your list of books and create a form using form_for(@book, url: path_to_favorite_update_path) and f.hidden_field(:book_id) -- in that controller action you could do something like... BooksUser.find_or_initialize_by(user_id: current_user.id, book_id: params[:book_id]).update_attributes!(favorite: true) - somethin like that
[17:08:34] lexileo: has joined #RubyOnRails
[17:10:52] samort7: ah, this is going to take a lot of time for me to process...
[17:15:57] conta: has joined #RubyOnRails
[17:19:37] darkhanb: has joined #RubyOnRails
[17:22:56] syndikate: thasnk crankharder
[17:38:19] kapil____: has joined #RubyOnRails
[17:47:10] otherj: is devise / cancancan still the recommended authentication/authorization stack these days?
[17:47:42] otherj: and what's the 2018 ruport gem?
[17:50:23] otherj: also, (sorry, coming back to rails after about four years), do you people normally now still use local rbenv or something, or is everyone using docker & co.?
[17:59:48] orbyt_: has joined #RubyOnRails
[18:02:38] merzu1: has joined #RubyOnRails
[18:03:03] samort7: has joined #RubyOnRails
[18:04:27] merzu1: Hello. Please help. How to get rails not to use expression in 'GROUP BY'. E.g. I did `Person.group('num - 1').count('id')`, and Rails generate the SQL `SELECT COUNT("people"."id") AS count_id, num - 1 AS num_1 FROM "people" GROUP BY num - 1;`, so how to use the alias `num_` in the GROUP condition
[18:08:21] davidh38: has joined #RubyOnRails
[18:19:45] whysthatso: has joined #RubyOnRails
[18:28:01] eckhardt: has joined #RubyOnRails
[18:32:51] CGibsonmm: has joined #RubyOnRails
[18:34:55] chouhoulis: has joined #RubyOnRails
[18:45:38] chouhoulis: has joined #RubyOnRails
[18:48:19] buyfn: has joined #RubyOnRails
[18:53:46] jane_booty_doe: has joined #RubyOnRails
[18:54:30] whysthatso: has joined #RubyOnRails
[18:56:38] DTZUZO: has joined #RubyOnRails
[19:09:34] reber: has joined #RubyOnRails
[19:20:04] SteenJobs: has joined #RubyOnRails
[19:30:38] lxsameer: has joined #RubyOnRails
[19:35:18] davidh38: has joined #RubyOnRails
[19:39:10] hnanon: has joined #RubyOnRails
[19:50:45] davidh38: has joined #RubyOnRails
[19:51:46] SteenJobs: has joined #RubyOnRails
[19:51:49] davidh38: has joined #RubyOnRails
[19:55:24] Fernando-Basso: has joined #RubyOnRails
[19:58:39] whysthatso: has joined #RubyOnRails
[19:59:43] Guest53511: has joined #RubyOnRails
[20:01:32] tdy: has joined #RubyOnRails
[20:08:10] hnanon: has joined #RubyOnRails
[20:40:39] davidh38: has joined #RubyOnRails
[20:56:36] Inside: anyone here use acts_as_list?
[20:56:45] Inside: any way to get a list of items that changed when an item was moved?
[21:05:46] davidh38: has joined #RubyOnRails
[21:08:13] elcontrastador: has joined #RubyOnRails
[21:25:37] DTZUZO: has joined #RubyOnRails
[21:33:46] DTZUZO: has joined #RubyOnRails
[21:35:07] SteenJobs: has joined #RubyOnRails
[21:59:07] CGibsonmm: has joined #RubyOnRails
[22:05:16] eckhardt: has joined #RubyOnRails
[22:06:39] uks: has joined #RubyOnRails
[22:18:48] aarkerio: has joined #RubyOnRails
[22:19:21] aarkerio: hi! is there a way to customize the strong parameters response?
[22:19:46] aarkerio: I have: params.require(:data).require(*fields)
[22:20:04] aarkerio: and I want so set a 400 response when a field is missed
[22:30:16] crankharder: merzu1: group explicitly adds GROUP BY to your sql. read up on some active record: https://guides.rubyonrails.org/active_record_basics.html
[22:31:07] crankharder: aarkerio: for an API or for a normal form reseponse?
[22:31:21] aarkerio: for a normal response
[22:31:50] crankharder: you want your users to just get an error page?
[22:35:31] davidh38: has joined #RubyOnRails
[22:38:09] appelzaf: has joined #RubyOnRails
[22:38:54] appelzaf: Is there any way to share the database connection pool between multiple application servers, all pointing to the same DB?
[22:43:25] appelzaf: Possibly a stupid question, but since I have multiple app servers all talking to the same database I thought there is perhaps a way to reduce db connection churn
[22:44:45] appelzaf: Ie, a connection pool proxy if you will
[22:45:53] Inside: I don't think so
[22:45:56] Inside: I suffer from the same problem
[22:46:29] Inside: The solution that I have been kicking around is a database connection cache/proxy application
[22:46:47] Inside: everything talks to that application, then that application is responsible for caching intermediate stuff before pushing it to the DB
[22:48:44] appelzaf: Yeah, I've containerized my app so I'm trying to figure out if it's better to have fewer, but faster containers versus more, but slower. The later obviously means more database connections required :<
[22:49:34] appelzaf: (Constraint being a single database shared between them all)
[22:59:47] eckhardt: has joined #RubyOnRails
[23:00:39] blassin: has joined #RubyOnRails
[23:00:59] davidh38: has joined #RubyOnRails
[23:02:36] Inside: interesting
[23:02:44] Inside: what server do you use? I have nginx+passenger
[23:03:09] Inside: 2~3 processes per application
[23:03:18] Inside: but yeah, a database connection pool per every process
[23:03:22] jetchisel: has joined #RubyOnRails
[23:05:12] eckhardt: has joined #RubyOnRails
[23:08:33] mikecmpbll: has joined #RubyOnRails
[23:15:57] SteenJobs: has joined #RubyOnRails
[23:23:21] davidh38: has joined #RubyOnRails
[23:26:03] eckhardt: has joined #RubyOnRails
[23:31:19] gambl0re: has joined #RubyOnRails
[23:33:53] CGibsonmm: has joined #RubyOnRails
[23:44:53] eckhardt: has joined #RubyOnRails
[23:52:07] segy: has joined #RubyOnRails
[23:56:19] jane_booty_doe: has joined #RubyOnRails