aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/persistence.rb
diff options
context:
space:
mode:
authorlsylvester <lachlan.sylvester@hypothetical.com.au>2014-08-11 13:31:31 +1000
committerlsylvester <lachlan.sylvester@hypothetical.com.au>2014-08-11 20:56:21 +1000
commit0f99aa615e11c50cc64b567f54cf64f59108c5e5 (patch)
treea3e62ee239e39461070ddef9c538e8e67d40e7fc /activerecord/lib/active_record/persistence.rb
parent49798b52bfaaa452f1c535ca932cc267482348fe (diff)
downloadrails-0f99aa615e11c50cc64b567f54cf64f59108c5e5.tar.gz
rails-0f99aa615e11c50cc64b567f54cf64f59108c5e5.tar.bz2
rails-0f99aa615e11c50cc64b567f54cf64f59108c5e5.zip
update error message to reflect that the record could have been destroyed
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r--activerecord/lib/active_record/persistence.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index b5799d6bff..51b1931ed5 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -287,7 +287,8 @@ module ActiveRecord
# This method raises an +ActiveRecord::ActiveRecordError+ when called on new
# objects, or when at least one of the attributes is marked as readonly.
def update_columns(attributes)
- raise ActiveRecordError, "cannot update on a new record object" unless persisted?
+ raise ActiveRecordError, "cannot update a new record" if new_record?
+ raise ActiveRecordError, "cannot update a destroyed record" if destroyed?
attributes.each_key do |key|
verify_readonly_attribute(key.to_s)