mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
rescue record invalid exceptions and return false from the save method. fixes #796
This commit is contained in:
@@ -33,7 +33,11 @@ module ActiveRecord
|
||||
# +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.
|
||||
|
||||
Reference in New Issue
Block a user