Module: Pseudocephalopod::Caching::InstanceMethods
- Defined in:
- lib/pseudocephalopod/caching.rb
Instance Method Summary collapse
-
#globally_cache_slug ⇒ Object
Automatically called in after_save, will cache this records id with to match the current records slug / scope.
-
#remove_slug_history! ⇒ Object
Wraps remove_slug_history! to remove each of the slugs recording in this models slug history.
Instance Method Details
#globally_cache_slug ⇒ Object
Automatically called in after_save, will cache this records id with to match the current records slug / scope
21 22 23 24 25 26 27 28 29 |
# File 'lib/pseudocephalopod/caching.rb', line 21 def globally_cache_slug return unless send(:"#{self.cached_slug_column}_changed?") value = self.to_slug self.class.cache_slug_lookup!(value, self) if value.present? unless use_slug_history value = send(:"#{self.cached_slug_column}_was") self.class.cache_slug_lookup!(value, nil) end end |
#remove_slug_history! ⇒ Object
Wraps remove_slug_history! to remove each of the slugs recording in this models slug history.
33 34 35 36 |
# File 'lib/pseudocephalopod/caching.rb', line 33 def remove_slug_history! previous_slugs.each { |s| self.class.cache_slug_lookup!(s, nil) } super end |