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:
commit
f61a38a160
2 changed files with 7 additions and 1 deletions
|
@ -115,7 +115,7 @@ module ActiveModel
|
||||||
end
|
end
|
||||||
|
|
||||||
def freeze
|
def freeze
|
||||||
@attributes = @attributes.clone.freeze
|
@attributes = @attributes.clone.freeze unless frozen?
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -129,5 +129,11 @@ module ActiveModel
|
||||||
assert data.frozen?
|
assert data.frozen?
|
||||||
assert_raise(FrozenError) { data.integer_field = 1 }
|
assert_raise(FrozenError) { data.integer_field = 1 }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "attributes can be frozen again" do
|
||||||
|
data = ModelForAttributesTest.new
|
||||||
|
data.freeze
|
||||||
|
assert_nothing_raised { data.freeze }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue