From 83223424b33e332673fc3e4bdcae7477e601377f Mon Sep 17 00:00:00 2001 From: Angelo capilleri Date: Wed, 12 Dec 2012 18:26:38 +0100 Subject: Removed :if and :unless from fragment cache option in favour of cache_if(condition, option, &block) and cache_unless(condition, option, &block). In the PR #8371 was introduced conditional options :if and :unless in the cache method. Example: <%= cache @model, if: some_condition(@model) do %> ... <%end%> This is a good feature but *cache_if* and and *cache_unless* are more concise and close to the standard of rails view helpers (ex: link_to_if and link_to_unless). Example: <%= cache_if condition, @model do %> ... <%end%> --- actionpack/CHANGELOG.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'actionpack/CHANGELOG.md') diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index f2f75dde36..192714418f 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -33,11 +33,23 @@ *DHH* -* Add :if / :unless conditions to fragment cache: +* Add `cache_if` and `cache_unless` for conditional fragment caching: - <%= cache @model, if: some_condition(@model) do %> + Example: + + <%= cache_if condition, project do %> + All the topics on this project + <%= render project.topics %> + <% end %> - *Stephen Ausman + Fabrizio Regini* + #and + + <%= cache_unless condition, project do %> + All the topics on this project + <%= render project.topics %> + <% end %> + + *Stephen Ausman + Fabrizio Regini + Angelo Capilleri* * Add filter capability to ActionController logs for redirect locations: -- cgit v1.2.3