File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 1+ * When calling ` update_columns ` on a record that is not persisted, the error
2+ message now reflects whether that object is a new record or has been
3+ destroyed.
4+
5+ * Lachlan Sylvester*
6+
17* Define ` id_was ` to get the previous value of the primary key.
28
39 Currently when we call id_was and we have a custom primary key name
Original file line number Diff line number Diff line change @@ -287,7 +287,8 @@ def update_column(name, value)
287287 # This method raises an +ActiveRecord::ActiveRecordError+ when called on new
288288 # objects, or when at least one of the attributes is marked as readonly.
289289 def update_columns ( attributes )
290- raise ActiveRecordError , "cannot update on a new record object" unless persisted?
290+ raise ActiveRecordError , "cannot update a new record" if new_record?
291+ raise ActiveRecordError , "cannot update a destroyed record" if destroyed?
291292
292293 attributes . each_key do |key |
293294 verify_readonly_attribute ( key . to_s )
You can’t perform that action at this time.
0 commit comments