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

Merge pull request #40547 from alpaca-tc/multiple_freeze_active_model

[6.1.0.rc1] ActiveModel::Attributes can be frozen again
This commit is contained in:
Ryuta Kamizono 2020-11-05 21:29:26 +09:00 committed by GitHub
commit f61a38a160
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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