lib/draper/automatic_delegation.rb in draper-3.0.0.pre1 vs lib/draper/automatic_delegation.rb in draper-3.0.0

- old
+ new

@@ -1,14 +1,16 @@ module Draper module AutomaticDelegation extend ActiveSupport::Concern - # Delegates missing instance methods to the source object. + # Delegates missing instance methods to the source object. Note: This will delegate `super` + # method calls to `object` as well. Calling `super` will first try to call the method on + # the parent decorator class. If no method exists on the parent class, it will then try + # to call the method on the `object`. def method_missing(method, *args, &block) return super unless delegatable?(method) - self.singleton_class.delegate method - send(method, *args, &block) + object.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_missing?(method, include_private = false)