Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #6331 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

[PATCH] class_inheritable_accessor inheritance doesn't work properly with array or hash

Reported by: mojombo Assigned to: David
Priority: normal Milestone: 1.x
Component: ActiveSupport Version: edge
Severity: normal Keywords:
Cc:

Description

If you create a class_inheritable_accessor and initialize it to an array or hash in the parent class, any modifications to that array will be seen on both the child and parent. This is because the root hash that stores the inheritable variables is copied to the child via #dup which does a shallow copy. This patch does a #dup for each variable in the inheritable array, making it compliant with the documentation. Tests are included.

Attachments

class_inheritable_accessor_fix.diff (2.0 kB) - added by mojombo on 10/02/06 17:56:23.

Change History

10/02/06 17:56:23 changed by mojombo

  • attachment class_inheritable_accessor_fix.diff added.

10/02/06 19:13:36 changed by rick

  • status changed from new to closed.
  • resolution set to fixed.

fixed in [5218].