Skip to content

Commit

Permalink
rescue record invalid exceptions and return false from the save method.
Browse files Browse the repository at this point in the history
fixes #796
  • Loading branch information
tenderlove committed May 24, 2011
1 parent 1c079c5 commit 79abb70
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion activerecord/lib/active_record/persistence.rb
Expand Up @@ -36,7 +36,11 @@ def persisted?
# +save+ returns +false+. See ActiveRecord::Callbacks for further # +save+ returns +false+. See ActiveRecord::Callbacks for further
# details. # details.
def save(*) def save(*)
create_or_update begin
create_or_update
rescue ActiveRecord::RecordInvalid
false
end
end end


# Saves the model. # Saves the model.
Expand Down

0 comments on commit 79abb70

Please sign in to comment.