File tree 2 files changed +8
-1
lines changed
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
+
1
7
* Define ` id_was ` to get the previous value of the primary key.
2
8
3
9
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)
287
287
# This method raises an +ActiveRecord::ActiveRecordError+ when called on new
288
288
# objects, or when at least one of the attributes is marked as readonly.
289
289
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?
291
292
292
293
attributes . each_key do |key |
293
294
verify_readonly_attribute ( key . to_s )
You can’t perform that action at this time.
0 commit comments