aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2006-10-02 19:12:57 +0000
committerRick Olson <technoweenie@gmail.com>2006-10-02 19:12:57 +0000
commit928c84b65b6d34ca9cbfd698c1c01f8517d54ee1 (patch)
treeedf512edd4624651d47c3d027203968340cea449 /activesupport/lib
parent297ac55b295bd73f9f862e608639e62a9c444e84 (diff)
downloadrails-928c84b65b6d34ca9cbfd698c1c01f8517d54ee1.tar.gz
rails-928c84b65b6d34ca9cbfd698c1c01f8517d54ee1.tar.bz2
rails-928c84b65b6d34ca9cbfd698c1c01f8517d54ee1.zip
Fix issue with #class_inheritable_accessor saving updates to the parent class when initialized with an Array or Hash [mojombo]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5218 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
index 2e70a64436..bc8bf09ab2 100644
--- a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
+++ b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
@@ -107,7 +107,12 @@ class Class # :nodoc:
private
def inherited_with_inheritable_attributes(child)
inherited_without_inheritable_attributes(child) if respond_to?(:inherited_without_inheritable_attributes)
- child.instance_variable_set('@inheritable_attributes', inheritable_attributes.dup)
+
+ new_inheritable_attributes = inheritable_attributes.inject({}) do |memo, (key, value)|
+ memo.update(key => (value.dup rescue value))
+ end
+
+ child.instance_variable_set('@inheritable_attributes', new_inheritable_attributes)
end
alias inherited_without_inheritable_attributes inherited