1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

ActiveModel::Model can be frozen again

This commit is contained in:
alpaca-tc 2020-11-05 20:52:27 +09:00
parent 6d40c1d0be
commit e4e62fbdc6
2 changed files with 7 additions and 1 deletions

View file

@ -115,7 +115,7 @@ module ActiveModel
end
def freeze
@attributes = @attributes.clone.freeze
@attributes = @attributes.clone.freeze unless frozen?
super
end

View file

@ -129,5 +129,11 @@ module ActiveModel
assert data.frozen?
assert_raise(FrozenError) { data.integer_field = 1 }
end
test "attributes can be frozen again" do
data = ModelForAttributesTest.new
data.freeze
assert_nothing_raised { data.freeze }
end
end
end