diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-10-02 03:21:32 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-10-02 03:21:32 +0000 |
commit | ef4fb3dee2e897b245ee6f545232378db3de7b38 (patch) | |
tree | 42e47264ddce4b70da1308d7bfc92e7fe5b1d84a /activerecord/lib/active_record | |
parent | 0092d0ac6de041995d6f4555c6e52590799cbefb (diff) | |
download | rails-ef4fb3dee2e897b245ee6f545232378db3de7b38.tar.gz rails-ef4fb3dee2e897b245ee6f545232378db3de7b38.tar.bz2 rails-ef4fb3dee2e897b245ee6f545232378db3de7b38.zip |
save! shouldn't validate twice. Closes #6324.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5215 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 43f631ef6c..af2645eeb7 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1527,14 +1527,13 @@ module ActiveRecord #:nodoc: # * No record exists: Creates a new record with values matching those of the object attributes. # * A record does exist: Updates the record with values matching those of the object attributes. def save - raise ReadOnlyRecord if readonly? create_or_update end # Attempts to save the record, but instead of just returning false if it couldn't happen, it raises a # RecordNotSaved exception def save! - save || raise(RecordNotSaved) + create_or_update || raise(RecordNotSaved) end # Deletes the record in the database and freezes this instance to reflect that no changes should @@ -1765,6 +1764,7 @@ module ActiveRecord #:nodoc: private def create_or_update + raise ReadOnlyRecord if readonly? if new_record? then create else update end true end |