This project is archived and is in readonly mode.
config.action_controller.perform_caching is ignored
Reported by Simone Carletti | May 10th, 2010 @ 09:20 PM
I first noticed this issue with Rails 3 beta3.
Even if you set
config.action_controller.perform_caching = false
in the environment, the configuration is always ignored and
defaults to true.
The result is that Rails always tries to perform page/fragment
caching, even if you are using the development environment.
If you directly access the ActionController::Base class, it works as expected.
ActionController::Base.perform_caching = false
You can easily reproduce the issue creating a new Rails app with beta3 and running the server or even trying to access the configuration from the console.
I investigated the issue and the guilty seems to be the following ActionController initializer
initializer "action_controller.set_configs"
The configuration value exists in
app.config.action_controller
but the configuration is
never applied to the class on ActionController::Base
load.
action_controller/railtie.rb
has been recently
changed in
http://github.com/rails/rails/commit/4163ccec2343ee66e2488f067eab2a...
but the changes doesn't seem to fix the issue.
Comments and changes to this ticket
-
Neeraj Singh May 10th, 2010 @ 09:48 PM
I tested it with rails3 edge and am not able to reproduce this issue. I was expecting page caching but I do not see any page cached. This is what I did.
rails demo
cd demo
rails g scaffold User name:string
rake db:migrate
rails svisit http://localhost:3000/users
Looked at public directory and I do not see any page cached.
-
Simone Carletti May 10th, 2010 @ 10:07 PM
The code you posted shouldn't automatically perform page caching, unless you specify
cache_pages
in your controller.
However, I switched to rails edge the project and the issue seems to be fixed.The ticket can be closed, thank you.
-
Neeraj Singh May 10th, 2010 @ 10:10 PM
You are right. I forgot to add cache_pages.
Anyway it seems it is no more an issue.
-
Jérémy Lecour May 10th, 2010 @ 10:28 PM
- Tag changed from rails 3.0.0.beta3, actioncontroller, perform_caching to rails 3.0.0.beta3, actioncontroller, caching, perform_caching
Today, I've pulled my hair on something that seems similar.
I'm working on a Rails 3.0.0.beta.3 app where I want to do some page caching.
In "Rails.root/config/development.rb" I've put
config.action_controller.perform_caching = true config.page_cache_directory = File.join Rails.root, 'public', 'cache' config.action_controller.page_cache_directory = File.join Rails.root, 'public', 'cache'
I've tried two different "page_cache_directory" directives because I've seen both in blog posts, docs, …
Whatever I put in theses directives, the page cache is written in "Rails.root/public/"
In the same file, if I write "ActionController::Base.page_cache_directory = File.join Rails.root, 'public', 'cache'" inside or outside the "MyApp::Application.configure" block, it has no effect.
BUT, if I make an initializer with it, it's working great.
-
Jérémy Lecour May 10th, 2010 @ 10:34 PM
I've tried to install (with bundler) the master branch from Github (http://github.com/rails/rails/commit/446b0ffe1c804f4925867d785b9709...) and it seems fixed.
The correct directive to put in the environment file is
config.action_controller.page_cache_directory = File.join Rails.root, 'public', 'cache'
The other one, has no effect.
There is no need to make a specific initializer.
-
Ryan Bigg May 13th, 2010 @ 11:43 PM
- State changed from new to invalid
Please open another bug for this issue Jérémy.
-
Jérémy Lecour May 14th, 2010 @ 07:33 AM
As I've said, the bug is already resolved. But If you like to have an "history", I can make a new issue that you'll immediately close.
Thanks
-
mirza June 2nd, 2010 @ 07:40 AM
I have the same problem:
config.action_controller.perform_caching = false
in development.rb is ignored and caching is performed always.
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>