Sha256: e8d70e81149a5cb67d6849c298ee19142d45e4bf11ab89757a5c52b728b1dca2
Contents?: true
Size: 493 Bytes
Versions: 1
Compression:
Stored size: 493 Bytes
Contents
module Draper::ModelSupport def decorator @decorator ||= "#{self.class.name}Decorator".constantize.decorate(self) block_given? ? yield(@decorator) : @decorator end alias :decorate :decorator module ClassMethods def decorate(context = {}) @decorator_proxy ||= "#{model_name}Decorator".constantize.decorate(self.scoped) 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.9.5 | lib/draper/model_support.rb |