Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rescue record invalid exceptions and return false from the save metho…

…d. fixes #796
  • Loading branch information...
commit 656e7b08073fa4e620a6d9ce0de554f8f5be96bb 1 parent 1d864e8
@tenderlove tenderlove authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 activerecord/lib/active_record/persistence.rb
View
6 activerecord/lib/active_record/persistence.rb
@@ -33,7 +33,11 @@ def persisted?
# +save+ returns +false+. See ActiveRecord::Callbacks for further
# details.
def save(*)
- create_or_update
+ begin
+ create_or_update
+ rescue ActiveRecord::RecordInvalid
+ false
+ end
end
# Saves the model.
Please sign in to comment.
Something went wrong with that request. Please try again.