Last active
March 2, 2017 06:54
-
-
Save Teddybiers/aa27e47ff67695afb57f5d819cec9153 to your computer and use it in GitHub Desktop.
Rescue an error when assign_attributes can't find an attribute in rails
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
def assign_attributes(*arguments) | |
super | |
rescue ActiveRecord::UnknownAttributeError => e # Error that you get from activerecord | |
# do something here! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment