Last active
August 29, 2015 14:09
-
-
Save moserrya/c276d5d8a93f8a54bfee to your computer and use it in GitHub Desktop.
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
item = Item.find 328 | |
item.transaction do | |
item.feelings.create!(size: 'huge') | |
item.update_attributes!(state: "sold") | |
end | |
# item.update_attributes! fails a validation, which we rescue. new feeling that we created is rightly rolled back | |
item.save #saves the feelings record that was rolled back as part of our transaction! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment