Sha256: c049db89caf140dc4d60a52c7763081aaed7f566a5fa4498522471cb2ac1dcdf
Contents?: true
Size: 511 Bytes
Versions: 10
Compression:
Stored size: 511 Bytes
Contents
module Draper::ModelSupport extend ActiveSupport::Concern 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 end
Version data entries
10 entries across 10 versions & 1 rubygems