Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/ca_ching/adapters/active_record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#from_cacheObject

Returns the value of attribute from_cache.



7
8
9
# File 'lib/ca_ching/adapters/active_record.rb', line 7

def from_cache
  @from_cache
end

Instance Method Details

#from_cache?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/ca_ching/adapters/active_record.rb', line 9

def from_cache?
  @from_cache ||= false
end

#to_keys(options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/ca_ching/adapters/active_record.rb', line 13

def to_keys(options={})
  was = options[:old_values] ? "_was" : ""
  indexed_fields.map do |index, options|
    if index.is_a?(Array)
      self.class.table_name.to_s + index.map { |index| "#{index}=#{self.send("#{index}#{was}")}" }.join("&")
    else
      "#{self.class.table_name}:#{index}=#{self.send("#{index}#{was}")}"
    end
  end
end