method

class_inheritable_hash

rails latest stable - Class: Class

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v3.1.0) is shown here.

class_inheritable_hash(*syms)
public

No documentation available.

# File activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb, line 123
  def class_inheritable_hash(*syms)
    class_inheritable_reader(*syms)
    class_inheritable_hash_writer(*syms)
  end

1Note

Merges with inherited values from super class

awendt ยท Apr 21, 20091 thank

http://www.spacevatican.org/2008/8/19/fun-with-class-variables

"When you set a class_inheritable_array or a class_inheritable_hash you are actually concatenating (or merging) with the value inherited from the super class."

==== Code example

class Base
class_inheritable_hash :attrs
self.attrs = {:name => 'Fred'}
end

class Derived < Base
self.attrs = {:export => 'Pain'}
end

Derived.attrs #=> {:name => 'Fred', :export => 'Pain'}