lib/draper/automatic_delegation.rb in draper-1.1.0 vs lib/draper/automatic_delegation.rb in draper-1.2.0
- old
+ new
@@ -10,11 +10,11 @@
send(method, *args, &block)
end
# Checks if the decorator responds to an instance method, or is able to
# proxy it to the source object.
- def respond_to?(method, include_private = false)
+ def respond_to_missing?(method, include_private = false)
super || delegatable?(method)
end
# @private
def delegatable?(method)
@@ -29,16 +29,22 @@
source_class.send(method, *args, &block)
end
# Checks if the decorator responds to a class method, or is able to proxy
# it to the source class.
- def respond_to?(method, include_private = false)
+ def respond_to_missing?(method, include_private = false)
super || delegatable?(method)
end
# @private
def delegatable?(method)
source_class? && source_class.respond_to?(method)
+ end
+
+ # @private
+ # Avoids reloading the model class when ActiveSupport clears autoloaded
+ # dependencies in development mode.
+ def before_remove_const
end
end
included do
private :delegatable?