开发者

Rails 3 development environment keeps caching, even without caching on?

开发者 https://www.devze.com 2023-02-25 18:17 出处:网络
i have a rails 3 app in dev mode开发者_如何学Go 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 developme

i have a rails 3 app in dev mode开发者_如何学Go 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?


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.


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


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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号