Skip to content

Instantly share code, notes, and snippets.

@lulalala
Created October 7, 2015 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lulalala/47b71b7f6014153a0351 to your computer and use it in GitHub Desktop.
Save lulalala/47b71b7f6014153a0351 to your computer and use it in GitHub Desktop.
Active Model errors landmine
book.errors.keys
[:title]
book.errors[:base].present?
false
book.errors.keys
[:title, :base]
# and someone does this
if book.errors.keys.include?(:base)
boom!()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment