Permalink
Browse files

Move the CacheHelper#fragment_name_with_digest to be public so custom…

… fragment caching can benefit from it.
  • Loading branch information...
1 parent 1b73dbd commit 3fdb7126110caad3f3db4c2b44ffc365b51c34eb @rgarver rgarver committed Sep 27, 2012
Showing with 11 additions and 11 deletions.
  1. +11 −11 actionpack/lib/action_view/helpers/cache_helper.rb
View
22 actionpack/lib/action_view/helpers/cache_helper.rb
@@ -113,6 +113,17 @@ def cache(name = {}, options = nil, &block)
nil
end
+ def fragment_name_with_digest(name)
+ if @virtual_path
+ [
+ *Array(name.is_a?(Hash) ? controller.url_for(name).split("://").last : name),
+ Digestor.digest(@virtual_path, formats.last.to_sym, lookup_context)
+ ]
+ else
+ name
+ end
+ end
+
private
# TODO: Create an object that has caching read/write on it
def fragment_for(name = {}, options = nil, &block) #:nodoc:
@@ -131,17 +142,6 @@ def fragment_for(name = {}, options = nil, &block) #:nodoc:
controller.write_fragment(name, fragment, options)
end
end
-
- def fragment_name_with_digest(name)
- if @virtual_path
- [
- *Array(name.is_a?(Hash) ? controller.url_for(name).split("://").last : name),
- Digestor.digest(@virtual_path, formats.last.to_sym, lookup_context)
- ]
- else
- name
- end
- end
end
end
end

0 comments on commit 3fdb712

Please sign in to comment.