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:
parent
6d40c1d0be
commit
e4e62fbdc6
2 changed files with 7 additions and 1 deletions
|
@ -115,7 +115,7 @@ module ActiveModel
|
|||
end
|
||||
|
||||
def freeze
|
||||
@attributes = @attributes.clone.freeze
|
||||
@attributes = @attributes.clone.freeze unless frozen?
|
||||
super
|
||||
end
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue