Skip to content

Instantly share code, notes, and snippets.

@Teddybiers
Last active March 2, 2017 06:54
Show Gist options
  • Save Teddybiers/aa27e47ff67695afb57f5d819cec9153 to your computer and use it in GitHub Desktop.
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
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