diff options
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 1f96e6dcc5..bb6869c6ce 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2864,6 +2864,13 @@ module ActiveRecord #:nodoc: @attributes.frozen? end + # Returns duplicated record with unfreezed attributes. + def dup + obj = super + obj.instance_variable_set('@attributes', instance_variable_get('@attributes').dup) + obj + end + # Returns +true+ if the record is read only. Records loaded through joins with piggy-back # attributes will be marked as read only since they cannot be saved. def readonly? |