Rails 3 development environment keeps caching, eve

2019-06-14 22:21发布

i have a rails 3 app in dev mode that won't load any changes i make when its running webrick. i triple checked the settings for my development.rb and made sure i am running in development mode.

config.cache_classes = false
config.action_controller.perform_caching = false

i also checked my tmp directory to make sure the cache folder is empty - i have yet to do any caching on the site and have never turned on caching. im guessing its a loading problem with the files.

also i was running on webrick then installed mongrel and the problem still persists.

im guessing ive run into a config problem, bc i dont see anyone else posting such a prob. anything else im missing?

EDIT: it looks like my view helpers aren't auto loadable - aren't helpers by default supposed to be reloadable in rails 3?

5条回答
Luminary・发光体
2楼-- · 2019-06-14 22:54

I'm using Rails 4, and my cache call was in a helper using Rails.cache.fetch.

After googling a bit, I found out this issue (https://github.com/rails/rails/issues/20733), where a PR was merged into rails 5 documentation to make clear that '

Changing the value of config.action_controller.perform_caching will only have an effect on the caching provided by the Action Controller component. For instance, it will not impact low-level caching, that we address below.

', being 'low-level-caching' the Rails.cache.fetch.

It's on the docs now: http://guides.rubyonrails.org/caching_with_rails.html

查看更多
Luminary・发光体
3楼-- · 2019-06-14 23:00

I've had a similar experience, but I don't believe it was with an actual helper class, it was with anything I wrote under the lib/ directory. If you've had to use a require 'some_class' statement, then you should switch it to:

require_dependency 'some_class'

Worked like a charm for me.

查看更多
ら.Afraid
4楼-- · 2019-06-14 23:03

I know this is an old question, but for anyone coming here with a similar issue, make sure you didn't accidentally move production.rb from config/environments/ to config/initializers/ like I did. That will make Rails read in the production.rb file and override your development settings. Whoops.

查看更多
时光不老,我们不散
5楼-- · 2019-06-14 23:11

I had the same problem and here is the simple solution.
In your config/environments/development.rb set following settings:

config.action_controller.perform_caching = false
config.perform_caching = false
config.cache_store = :null_store
查看更多
家丑人穷心不美
6楼-- · 2019-06-14 23:13

Had the same issue, it was caused by rails-dev-tweaks gem which is, if you used default configuration from README, disabling stack reload upon AJAX requests.

查看更多
登录 后发表回答