Skip to content
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

Merged
merged 1 commit into from
Jan 17, 2024
Merged

Conversation

danielmorrison
Copy link
Member

No description provided.

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?)
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha!

Copy link
Member

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
Copy link
Member

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

Copy link
Member Author

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
Copy link
Member

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

@danielmorrison danielmorrison merged commit 47da613 into main Jan 17, 2024
1 check passed
@danielmorrison danielmorrison deleted the standard-rails branch January 17, 2024 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants