app/helpers/application_helper.rb
# Getter for a string key viable for use as a cache key for fragments involving
# the rending of collections of models.
#
# Assuming the +collection+ responds to #each and has an +id+ for each member, it
# returns a string from the concatenation of all IDs of the instances in the collection
# (joined with '-'), plus a global time stamp obtained by invoking #max( time_stamp_method )
# on the collection itself.
#
Getter for a string key viable for use as a cache key for fragments involving
the rending of collections of models.

Assuming the +collection+ responds to #each and has an +id+ for each member, it
returns a string from the concatenation of all IDs of the instances in the collection
(joined with '-'), plus a global time stamp obtained by invoking #max( time_stamp_method )
on the collection itself.
Getter for a string key viable for use as a cache key for fragments involving the rending of collections of models . Assuming the + collection + responds to #each and has an + id + for each member it returns a string from the concatenation of all IDs of the instances in the collection ( joined with ' - ' ) plus a global time stamp obtained by invoking #max ( time_stamp_method ) on the collection itself .
def cache_key_from_collection( collection )
    return "?" unless collection.respond_to?(:each)
    collection.map{ |row| row.id }.join('-') +
    collection.map{ |row| row.updated_at }.max.to_i.to_s
  end
def cache_key_from_collection ( collection ) return "?" unless collection . respond_to? ( :each ) collection . map { | row | row . id } . join ( '-' ) + collection . map { | row | row . updated_at } . max . to_i . to_s end
Getter for a string key viable for use as a cache key for fragments involving
the rending of collections of models.
Getter for a string key viable for use as a cache key for fragments involving the rending of collections of models .
collection
<not_specific>