Sha256: 9db1df82477d690a694e1fe3d7f9071757de9014bfc1685d89a19f9a66ec9dce
Contents?: true
Size: 580 Bytes
Versions: 1
Compression:
Stored size: 580 Bytes
Contents
require 'activerecord' require 'activesupport' require 'digest/md5' ActiveRecord::Base.class_eval { Array.class_eval { def cache_key if self.empty? 'empty' else ids_hash = Digest::MD5.hexdigest(self.collect{|item| item.id }.to_s) update_timestamp = max {|a,b| a.updated_at <=> b.updated_at }.updated_at.to_i.to_s create_timestamp = max {|a,b| a.created_at <=> b.created_at }.created_at.to_i.to_s self.first.class.to_s.tableize+'/'+length.to_s+'-'+ids_hash+'-'+create_timestamp+'-'+update_timestamp end end } }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
group_cache_key-0.2.0 | lib/group_cache_key.rb |