diff options
Diffstat (limited to 'activesupport/lib/active_support/concern.rb')
-rw-r--r-- | activesupport/lib/active_support/concern.rb | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/activesupport/lib/active_support/concern.rb b/activesupport/lib/active_support/concern.rb index 81fb859334..af3da937c7 100644 --- a/activesupport/lib/active_support/concern.rb +++ b/activesupport/lib/active_support/concern.rb @@ -4,17 +4,12 @@ module ActiveSupport # module M # def self.included(base) # base.extend ClassMethods - # base.send(:include, InstanceMethods) # scope :disabled, where(:disabled => true) # end # # module ClassMethods # ... # end - # - # module InstanceMethods - # ... - # end # end # # By using <tt>ActiveSupport::Concern</tt> the above module could instead be written as: @@ -31,10 +26,6 @@ module ActiveSupport # module ClassMethods # ... # end - # - # module InstanceMethods - # ... - # end # end # # Moreover, it gracefully handles module dependencies. Given a +Foo+ module and a +Bar+ @@ -118,7 +109,11 @@ module ActiveSupport @_dependencies.each { |dep| base.send(:include, dep) } super base.extend const_get("ClassMethods") if const_defined?("ClassMethods") - base.send :include, const_get("InstanceMethods") if const_defined?("InstanceMethods") + if const_defined?("InstanceMethods") + base.send :include, const_get("InstanceMethods") + ActiveSupport::Deprecation.warn "The InstanceMethods module inside ActiveSupport::Concern will be " \ + "no longer included automatically. Please define instance methods directly in #{base} instead.", caller + end base.class_eval(&@_included_block) if instance_variable_defined?("@_included_block") end end |