Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Cache digest opt out cleanup #8339

Merged
merged 2 commits into from

2 participants

@latortuga

Per original discussion in this thread with @carlosantoniodasilva and @rafaelfranca, I have cleaned up the CacheHelper changes and added a CHANGELOG. I couldn't figure out how to add to the closed PR so I made a new one - hope that's okay!

@rafaelfranca

@latortuga yes, there is not way to change already merged pull request.

Thank you so much for this one. Could you squash the code change commits?

Leave one for the CHANGELOG entry and another to the changes in the code.

latortuga added some commits
@latortuga latortuga Add CHANGELOG entry for opt-out option of automatic template digesting e969ba9
@latortuga latortuga Cleanup CacheHelper changes allowing opt-out of cache digests
Instead of deleting the skip_digest option flag, this changes the method to merely check the
key. This change is because of a discussion in this thread:

rails#8317

This commit also makes #fragment_name_with_digest private due to its
functionality being subsumed by #cache_fragment_name.
e105adc
@latortuga

@rafaelfranca Sure thing, I squashed the code changes into one commit and rebased to current master. Thanks for the guidance!

@rafaelfranca rafaelfranca merged commit 6c0ea88 into rails:master
@rafaelfranca

Thank you so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 27, 2012
  1. @latortuga
  2. @latortuga

    Cleanup CacheHelper changes allowing opt-out of cache digests

    latortuga authored
    Instead of deleting the skip_digest option flag, this changes the method to merely check the
    key. This change is because of a discussion in this thread:
    
    rails#8317
    
    This commit also makes #fragment_name_with_digest private due to its
    functionality being subsumed by #cache_fragment_name.
This page is out of date. Refresh to see the latest.
View
8 actionpack/CHANGELOG.md
@@ -1,5 +1,13 @@
## Rails 4.0.0 (unreleased) ##
+* Add option flag to `CacheHelper#cache` to manually bypass automatic template digests:
+
+ <% cache project, skip_digest: true do %>
+ ...
+ <% end %>
+
+ *Drew Ulmer*
+
* No sort Hash options in #grouped_options_for_select. *Sergey Kojin*
* Accept symbols as #send_data :disposition value *Elia Schito*
View
4 actionpack/lib/action_view/helpers/cache_helper.rb
@@ -126,7 +126,7 @@ def cache(name = {}, options = nil, &block)
# cannot be manually expired unless you know the exact key which is the
# case when using memcached.
def cache_fragment_name(name = {}, options = nil)
- skip_digest = options && options.delete(:skip_digest)
+ skip_digest = options && options[:skip_digest]
if skip_digest
name
@@ -135,6 +135,7 @@ def cache_fragment_name(name = {}, options = nil)
end
end
+ private
def fragment_name_with_digest(name) #:nodoc:
if @virtual_path
[
@@ -146,7 +147,6 @@ def fragment_name_with_digest(name) #:nodoc:
end
end
- private
# TODO: Create an object that has caching read/write on it
def fragment_for(name = {}, options = nil, &block) #:nodoc:
if fragment = controller.read_fragment(name, options)
Something went wrong with that request. Please try again.