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
| # This probably isn't a good thing to want to do, but it came up for me, | |
| # so in the spirit of helping others with weird problems (and because this | |
| # seems to be documented almost nowhere): | |
| after_save do | |
| if some_failing_condition | |
| errors.add(:something, "some failure happened.") | |
| raise ActiveRecord::RecordInvalid.new(self) | |
| end |