Created
February 10, 2011 12:07
-
-
Save saks/820421 to your computer and use it in GitHub Desktop.
unexpected behavior of #write_inheritable_attribute with Mongoid::Document included
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mongoid' | |
class A | |
include Mongoid::Document | |
write_inheritable_attribute :attr_name, 'attr for A' | |
class_inheritable_reader :attr_name | |
end | |
class B < A; end | |
puts A.attr_name.inspect, B.attr_name.inspect | |
class A1 | |
write_inheritable_attribute :attr_name, 'attr for A1' | |
class_inheritable_reader :attr_name | |
end | |
class B1 < A1; end | |
puts A1.attr_name.inspect, B1.attr_name.inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment