Sha256: b70aa407fd249b3923943f904f9e86314d58c8b8a8036907bffee992b0915d29
Contents?: true
Size: 541 Bytes
Versions: 2
Compression:
Stored size: 541 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
draper-0.11.1 | lib/draper/model_support.rb |
draper-0.11.0 | lib/draper/model_support.rb |