This project is archived and is in readonly mode.
Action caching (blocker): undefined local variable or method `cache'
Reported by ximus | April 24th, 2010 @ 01:56 PM | in 3.0.2
There is a bug here:
body = controller.render_to_string(:text => cache, :layout => true) unless @cache_layout
(Line 136 of action_controller/caching/actions.rb)
There is no cache variable declared, perhaps variable body is desired...
Here is the function context:
def filter(controller)
path_options = if @cache_path.respond_to?(:call)
controller.instance_exec(controller, &@cache_path)
else
@cache_path
end
cache_path = ActionCachePath.new(controller, path_options || {})
body = controller.read_fragment(cache_path.path, @store_options)
unless body
controller.action_has_layout = false unless @cache_layout
yield
controller.action_has_layout = true
body = controller._save_fragment(cache_path.path, @store_options)
end
body = controller.render_to_string(:text => cache, :layout => true) unless @cache_layout
controller.response_body = body
controller.content_type = Mime[cache_path.extension || :html]
end
Here is the link to the current implementation in master:
Comments and changes to this ticket
-
ximus April 24th, 2010 @ 01:58 PM
Rails versions concerned are version 3.beta3 and current master branch
-
ximus April 24th, 2010 @ 02:33 PM
Now that I think of it, you can trigger this as so:
@@@ruby AnyController < ApplicationController
caches_action :any_action # ... end -
ximus April 24th, 2010 @ 02:36 PM
Now that I think of it, you can trigger this as so:
AnyController < ApplicationController caches_action :any_action # ... end
with config.action_controller.perform_caching = true
-
Neeraj Singh April 24th, 2010 @ 06:16 PM
caches_action :index
Above code is working fine for me with rails3 edge.
-
Paul Barry April 24th, 2010 @ 08:51 PM
I'm using master aaaa1782b44c620cecb97238534a2bd2be5d365a and ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-darwin10.3.0], MBARI 0x6770, Ruby Enterprise Edition 2010.01
I have not been able to reproduce this problem with config.action_controller.perform_caching = true in the development environment. It is caching the action and serving the cached file.
-
Ryan Bigg April 25th, 2010 @ 12:19 AM
- State changed from new to open
-
ximus April 25th, 2010 @ 11:50 AM
I overlooked something, it happens when you specify :layout => false
AnyController < ApplicationController caches_action :any_action, :layout => false # ... end
Sorry about that, tried it against master just now and I'm getting the error message
undefined local variable or method
cache' for #<ActionController::Caching::Actions::ActionCacheFilter:...>
Working with standard MRI 1.8.7 on osx.
-
Ryan Bigg April 25th, 2010 @ 12:00 PM
- State changed from open to incomplete
Please submit a failing test case for this if you could.
-
Neeraj Singh April 25th, 2010 @ 02:17 PM
Attached is a patch which contains code change and tests.
ActionCachingTestController catches all the exceptions and returns head 500. However most of the tests were not checking for response_code. Hence this bug was not caught in the test. All I had to do was to ensure that all tests check for response code.
-
Neeraj Singh April 25th, 2010 @ 02:18 PM
- Tag changed from actioncontroller, caching, rails3 to actioncontroller, caching, patch, rails3
-
José Valim April 27th, 2010 @ 11:53 AM
- Milestone cleared.
- State changed from incomplete to open
- Assigned user set to José Valim
-
Repository April 29th, 2010 @ 11:52 AM
- State changed from open to resolved
(from [d793d30776737e46ead49d90dcba411c3dfd6edf]) ActionCachingTestController rescues from all exceptions. Making sure that all the tests check for valid response. [#4468 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/d793d30776737e46ead49d90dcba41... -
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
-
csnk May 18th, 2011 @ 08:21 AM
We are the professional sweaters manufacturer,sweaters supplier, sweaters factory, custom sweaters.
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>
People watching this ticket
Attachments
Referenced by
- 4468 Action caching (blocker): undefined local variable or method `cache' (from [d793d30776737e46ead49d90dcba411c3dfd6edf]) ActionC...