#RubyOnRails - 22 December 2018
« Back 1 day Forward 1 day »
[04:10:17] rodd: is there a way to let rails/active record handle duplicated records during an update on has_many through: relationships? The docs mention using a scope with distinct, but that still inserts dupes in the db
[04:11:05] rodd: for reference: https://guides.rubyonrails.org/association_basics.html#scopes-for-has-many-distinct
[05:44:28] baweaver: Technodrome / creamme: either that or it's the weekend and holiday season, meaning most people probably aren't online.
[05:45:00] Technodrome: sure, but just in general i think irc activity has been down for many channels
[06:22:01] creamme: I have loved how easy rails is until now; I am trying to update from 4 to 5 on a new server, and because of dependency problems I'm rebuilding my app, copying parts of code in hopes they work
[16:54:58] IGnorAND: running with webpack, I add <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> in my html and I see vue code, if I comment it out while I have import 'vue/dist/vue.js'; I dont see my vue code
[17:10:33] creamme: in index view for meals I have link_to( year, params.merge(year: year), class: "year") to try and make the link meals?year=2018 but I get UnfilteredParameters
[17:38:39] tbuehlmann: creamme: you might want `link_to(year, meals_path(year: params[:year]))` instead
[19:28:03] creamme: models/user.rb has logged_in? which works in views but not in controllers/meals_controller.rb what did I forget?
[19:32:35] tbuehlmann: creamme: it's not usual having such a method in the model. where and how is that defined?
[19:37:11] creamme: I define it as part of the model, don't remember why, I wrote this stuff about 6 years ago.
[19:55:19] tbuehlmann: you can put that method in the application controller and add a `helper_method :logged_in?` to that so that the view can use it
[19:56:17] tbuehlmann: see https://api.rubyonrails.org/classes/AbstractController/Helpers/ClassMethods.html#method-i-helper_method