diff --git a/lib/draper/active_model_support.rb b/lib/draper/active_model_support.rb index f8e5104..575ee15 100755 --- a/lib/draper/active_model_support.rb +++ b/lib/draper/active_model_support.rb @@ -10,11 +10,9 @@ module Draper::ActiveModelSupport proxies.each do |method_name, dependency| if base.model.kind_of?(dependency) || dependency.nil? - class << base - self - end.class_eval do + base.singleton_class.class_eval do if !base.class.instance_methods.include?(method_name) || base.class.instance_method(method_name).owner === Draper::Base - send(:define_method, method_name) do |*args, &block| + define_method(method_name) do |*args, &block| model.send(method_name, *args, &block) end end diff --git a/lib/draper/base.rb b/lib/draper/base.rb index 025a845..864f080 100755 --- a/lib/draper/base.rb +++ b/lib/draper/base.rb @@ -11,8 +11,6 @@ module Draper self.denied = DEFAULT_DENIED self.allowed = DEFAULT_ALLOWED - - # Initialize a new decorator instance by passing in # an instance of the source class. Pass in an optional # context inside the options hash is stored for later use.