Sha256: 093e47897dd044866f45eb199f91ea6900f623b8ff2c5f4b8fb3cd09379abdc3
Contents?: true
Size: 614 Bytes
Versions: 1
Compression:
Stored size: 614 Bytes
Contents
module Draper::ModelSupport extend ActiveSupport::Concern def decorator(options = {}) @decorator ||= decorator_class.decorate(self, options.merge(:infer => false)) block_given? ? yield(@decorator) : @decorator end def decorator_class "#{self.class.name}Decorator".constantize end alias :decorate :decorator module ClassMethods def decorate(options = {}) decorator_proxy = decorator_class.decorate(self.scoped, options) block_given? ? yield(decorator_proxy) : decorator_proxy end def decorator_class "#{model_name}Decorator".constantize end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
draper-0.18.0 | lib/draper/model_support.rb |