Module: Flattery::ValueCache::ClassMethods

Defined in:
lib/flattery/value_cache.rb

Instance Method Summary collapse

Instance Method Details

#flatten_value(options = {}) ⇒ Object

Command: adds flattery definition options. The options define a single cache setting. To define multiple cache settings, call flatten_value once for each setting.

options by example:

flatten_value :category => :name
# => will cache self.category.name to self.category_name
flatten_value :category => :name, :as => 'cat_name'
# => will cache self.category.name to self.cat_name

When explicitly passed nil, it clears all existing settings



23
24
25
# File 'lib/flattery/value_cache.rb', line 23

def flatten_value(options={})
  self.value_cache_options.add_setting(options)
end