module DelegateCached::ClassMethods
Public Instance Methods
delegate_cached(attribute, options = {})
click to toggle source
# File lib/delegate_cached.rb, line 11 def delegate_cached(attribute, options = {}) raise ArgumentError, 'The :to option is required' unless options[:to] reflection = reflect_on_association(options[:to]) if reflection.blank? raise ArgumentError, "The :to association :#{options[:to]} must exist on #{self}" end CachedAttribute.new(self, attribute, reflection, options).install! end