rails/rails — pull request #10200 by calebthompson (2013-04-13 04:18:04+00:00)
Title: Fix freeze applying to cloned objects

Previously, freezing a cloned ActiveRecord object froze the original too. By
cloning `@attributes` before freezing, we prevent cloned objects
(which in Ruby share state of ivars) from being effected by `#freeze`.

Resolves issue #4936, which has further information on this issue, as well as
steps to reproduce.

* Add a test case for `#freeze` not causing `cloned.frozen?` to be true.
* Clone @attributes before freezing in `ActiveRecord::Core`, then
reassign the cloned, frozen hash to the frozen model's `@attributes`
ivar.

/cc @steveklabnik