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