diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/af83/decorator.rb | 8 | ||||
| -rw-r--r-- | lib/af83/enhanced_decorator.rb | 1 | 
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/af83/decorator.rb b/lib/af83/decorator.rb index ec62edaaa..82954adc1 100644 --- a/lib/af83/decorator.rb +++ b/lib/af83/decorator.rb @@ -7,11 +7,17 @@ class AF83::Decorator < ModelDecorator    end    def self.instance_decorator -    @instance_decorator ||= Class.new(AF83::Decorator::InstanceDecorator) +    @instance_decorator ||= begin +      klass = Class.new(AF83::Decorator::InstanceDecorator) +      klass.delegate_all +      klass +    end    end    def self.with_instance_decorator +    @_with_instance_decorator = true      yield instance_decorator +    @_with_instance_decorator = false    end    def self.decorate object, options = {} diff --git a/lib/af83/enhanced_decorator.rb b/lib/af83/enhanced_decorator.rb index ad9a75000..91a377f8c 100644 --- a/lib/af83/enhanced_decorator.rb +++ b/lib/af83/enhanced_decorator.rb @@ -1,6 +1,7 @@  module AF83::EnhancedDecorator    module ClassMethods      def action_link args={} +      raise "You are using `action_link` inside a with_instance_decorator block, but not on the instance decorator itself.\n Use `instance_decorator.action_link` or move outside of the block, as this may lead to an unforeseen behaviour." if @_with_instance_decorator        args[:if] = @_condition if args[:if].nil?        options, link_options = parse_options args  | 
