-
-
Save dx7/4002062 to your computer and use it in GitHub Desktop.
update attribute
This file contains hidden or 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
# update_attribute | |
guitar.update_attribute(:state, 'used') | |
# method on model | |
class Guitar | |
def mark_as_used | |
self.state = 'used' | |
self.save | |
end | |
end | |
guitar.mark_as_used | |
# skipping validations the short way :) | |
class Guitar | |
def mark_as_used | |
update_attribute(:state, 'used') | |
end | |
end | |
guitar.mark_as_used |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment