-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add standard-rails and apply suggested updates #111
Conversation
User.find(changes["user_id"] || [user_id]).each do |user| | ||
user.last_pour_at = user.pours.finished.maximum(:created_at) | ||
user.save | ||
if finished_at && (user_id_changed? || finished_at_changed?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, that's why that hasn't been working. This is in an after save, so *_changed?
is always false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, technically, if the user_id changed, it should be updating 2 users. There are a couple of errors I've spotted on my home install that I should push updates for.
@@ -45,7 +45,7 @@ def check_dead | |||
def start_missing | |||
return unless @running | |||
|
|||
BeerTap.all.each do |tap| | |||
BeerTap.all.each do |tap| # standard:disable Rails/FindEach |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
find_each
is probably fine, but definitely overkill
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, same thought.
@@ -7,7 +7,7 @@ def index | |||
def destroy | |||
keg = Keg.find(params[:keg_id]) | |||
pour = keg.pours.find(params[:id]) | |||
pour.destroy | |||
pour.destroy! | |||
redirect_to :back |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This for example is wrong. It was replaced by redirect_back_or_to
No description provided.