Skip to content

Instantly share code, notes, and snippets.

@rbishop
Created October 3, 2013 23:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbishop/6818942 to your computer and use it in GitHub Desktop.
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.
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