Created
December 24, 2016 19:16
-
-
Save bleonard/47d5faee7dc865cb3ebf62db6d47f2df to your computer and use it in GitHub Desktop.
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
class Task < ActiveRecord::Base | |
after_save :sync_with_external | |
def sync_with_external | |
response = External.sync!(id: self.id, info: self.info) | |
if response.error? | |
self.errors.add(:base, "There was a problem, etc ...") | |
raise ActiveRecord::RecordInvalid.new(self) | |
end | |
true # I still do this out of superstition | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment