This project is archived and is in readonly mode.
caches_action with conditional
Reported by José Valim | May 11th, 2008 @ 03:30 PM
A couple of changes were made to ActionController::Caching::Actions:
- Added conditional option (:if) to caches_action method (just like in caches_page)
- Added :layout flag to caches_action method. If you specify :layout => false, the layout will not be cached, only the action content. This is useful since most application has user info in the layout. If the :layout is not set or set to true, we have the default behavior.
- Changes were documented
- Tests were added
- Test bug fix: added sleep(0.01) to assure that Time.now will be different.
The patch is attached.
Comments and changes to this ticket
-
Repository May 11th, 2008 @ 11:22 PM
- State changed from new to resolved
(from [9a137506a1267ec5938fcec4d2ff135f15037459]) Added not to sanitize helper docs that it doesn't guarantee well-formed markup.
Signed-off-by: Michael Koziarski
[#166 state:resolved]
-
Michael Koziarski May 11th, 2008 @ 11:29 PM
Could we have the patch without the :layout option? I'm not necessarily sold on that one prior to 2.1, but :if looks good.
-
José Valim May 12th, 2008 @ 12:26 AM
- Title changed from [PATCH] caches_action extension (with :if and :layout keys) to [PATCH] caches_action with conditional
:layout option removed! =)
Should I do another patch just with the :layout option?
And I don not know if would be important to document, but all parameters give to caches_action (except for :caches_path) are passed to the around_filter. This means that we can use the conditional (:if) and, also, use :only and :except to specify the actions we want to cache.
The same happens with caches_page.
-
Pratik May 13th, 2008 @ 12:06 PM
- Title changed from [PATCH] caches_action with conditional to caches_action with conditional
-
josh May 13th, 2008 @ 10:22 PM
- Assigned user set to josh
Looks good, but its making my AR integration tests fail for some reason. Maybe it has something todo w/ the tests you changed. Anyone else having this problem?
Updated
Its not related to the tests. The integration tests will fail only if the patch is applied to actions.
-
José Valim May 14th, 2008 @ 03:13 AM
It's also working fine for me.
I didn't get where is the problem yet (if there is any).
-
Pratik May 14th, 2008 @ 12:15 PM
- State changed from new to incomplete
Can you please use mocking instead of sleep(0.01) ?
Thanks.
-
José Valim May 14th, 2008 @ 06:07 PM
- no changes were found...
-
José Valim May 14th, 2008 @ 06:26 PM
Here we go!
As Pratik asked, I'm using a MockTime instead of sleep(0.01).
All tests pass!
-
josh May 14th, 2008 @ 06:31 PM
- State changed from incomplete to open
Hurray! Tests are passing. We'll take that patch ;)
-
Repository May 14th, 2008 @ 06:34 PM
- State changed from open to resolved
(from [7708650f73ddb4db300ea2059c60c1d907a4384e]) Added conditional support to caches_action [José Valim] [#166 state:resolved]
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>