lib/active_remote/integration.rb in active_remote-1.6.1 vs lib/active_remote/integration.rb in active_remote-1.7.0

- old
+ new

@@ -32,17 +32,17 @@ # Returns a cache key that can be used to identify this record. # # ==== Examples # # Product.new.cache_key # => "products/new" - # Product.search(:guid => "derp-5").cache_key # => "products/derp-5" (updated_at not available) - # Person.search(:guid => "derp-5").cache_key # => "people/derp-5-20071224150000" (updated_at available) + # Person.search(:guid => "derp-5").cache_key # => "people/derp-5-20071224150000" (include updated_at) + # Product.search(:guid => "derp-5").cache_key # => "products/derp-5" # def cache_key case when new_record? then "#{self.class.name.underscore}/new" - when timestamp = self[:updated_at] then + when ::ActiveRemote.config.default_cache_key_updated_at? && (timestamp = self[:updated_at]) then timestamp = timestamp.utc.to_s(self.class.cache_timestamp_format) "#{self.class.name.underscore}/#{self.to_param}-#{timestamp}" else "#{self.class.name.underscore}/#{self.to_param}" end