Class: Object

Inherits:
BasicObject
Defined in:
lib/versionable.rb

Instance Method Summary collapse

Instance Method Details

#versionable(options = {}) ⇒ Object

For extending models and assocations to provide an time based version number for cache expiration by changing part of the key we lookup the cache by.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/versionable.rb', line 4

def versionable(options = {})
  default_options = {
    # :cache => Rails.cache,
    :ttl => 0
  }
  instance_eval "
    class << self
      attr_accessor :versionable_options
    end
  "
  self.versionable_options = default_options.merge(options)

  include Versionable
end