Module: DelegateCached::ClassMethods
- Defined in:
- lib/delegate_cached.rb
Instance Method Summary collapse
Instance Method Details
#delegate_cached(attribute, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/delegate_cached.rb', line 11 def delegate_cached(attribute, = {}) raise ArgumentError, 'The :to option is required' unless [:to] reflection = reflect_on_association([:to]) if reflection.blank? raise ArgumentError, "The :to association :#{[:to]} must exist on #{self}" end CachedAttribute.new(self, attribute, reflection, ).install! end |