From e8d580ed2cf92396aeda3e04364fca638c91fc63 Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Sun, 13 May 2012 18:28:50 +0300 Subject: [PATCH 1/2] remove whitespaces --- lib/draper/base.rb | 2 -- 1 file changed, 2 deletions(-) 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. From af3eaf196f9c3f00be7b9afdfd04de7451668c3a Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Sun, 13 May 2012 18:29:24 +0300 Subject: [PATCH 2/2] use singleton_class since we drop ruby < 1.9.3 support --- lib/draper/active_model_support.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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