Created
October 3, 2013 23:54
-
-
Save rbishop/6818942 to your computer and use it in GitHub Desktop.
I imagine this is due to how ActiveSupport::Concern handles dependency resolution? It's pretty surprising though because you can use most other Rails class methods (before_filter, helper_method, belongs_to, etc. etc.) in the included method's block.
This file contains 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
module Surprisable | |
extend ActiveSupport::Concern | |
included do | |
attr_accessor :this_aint_gonna_work | |
end | |
end | |
module Wtfable | |
extend ActiveSupport::Concern | |
module ClassMethods | |
attr_accessor :neato | |
end | |
end | |
class WttfClass | |
include Surprisable | |
include Wtfable | |
end | |
WtfClass.this_aint_gonna_work = 'hey' | |
#=> NoMethodError: undefined method `this_aint_gonna_work` for WtfClass:Class | |
WtfClass.neato = true | |
#=> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment