-
-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
save(validate: false)
on internal saves, this way we don't mess…
… up with invalid models.
- Loading branch information
Showing
1 changed file
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 comments
on commit 7390b48
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.
Won't this cause the entire invalid model to be saved though, not just the new position? IMHO, puking on a position change is preferable to accidentally persisting unrelated, invalid data.
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.
I would do:
persisted? ? update_column(position_column, new_position) : update_attribute(position_column, new_position)
Update_column would be a better solution because it doesn't modified the updated_at which in turn invalidates the caching...