2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/helpers/hobo_cache_helper.rb', line 2
def hobo_cache_key(namespace=:views, route_on=nil, query_params=nil, attributes=nil)
attributes ||= {}
if route_on == true
route_on = this
end
if route_on.is_a?(ActiveRecord::Base)
route_on = url_for(route_on)
end
if route_on
attributes.reverse_merge!(Rails.application.routes.recognize_path(route_on))
elsif params[:page_path]
attributes.reverse_merge!(Rails.application.routes.recognize_path(params[:page_path]))
end
key_attrs = attributes
key_attrs[:only_path] = false
comma_split(query_params || "").each do |qp|
key_attrs["#{qp}"] = params[qp] || ""
end
key = ActiveSupport::Cache.expand_cache_key(url_for(key_attrs).split('://').last, namespace)
Digest::MD5.hexdigest(key)
end
|