Rails:cache_classes =>假仍然缓存 [英] Rails: cache_classes => false still caches

查看:66
本文介绍了Rails:cache_classes =>假仍然缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎 cache_classes =>false 仍会缓存它们,我必须关闭并重新启动服务器才能查看所有更改.有任何想法吗?我真的很困,这是一个非常烦人的问题.

It seems like cache_classes => false still caches them, and I have to shut down and restart the server to see any changes. Any ideas? I'm really stuck, and it's a very annoying problem.

我的 development.rb 看起来像这样:

Total::Application.configure do
  config.cache_classes = false
  config.whiny_nils = true
  config.threadsafe!
  # Add the fonts path
  config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
  # Precompile additional assets
  config.assets.precompile += %w( .svg .eot .woff .ttf )
  config.serve_static_assets = true
  # Show full error reports and disable caching
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false
  # config.eager_load = false
  config.action_mailer.default_url_options = { :host => 'lvh.me:3000' }
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default :charset => "utf-8"
  config.action_mailer.smtp_settings = {
    address: "smtp.gmail.com" # ETC
  }
  config.active_support.deprecation = :log
  config.action_dispatch.best_standards_support = :builtin
  config.active_record.mass_assignment_sanitizer = :strict
  config.assets.compress = false
  config.assets.debug = true
end

任何帮助都会很棒.谢谢.

Any help would be great. Thanks.

推荐答案

如果其他人遇到此问题,则解决的方法是: config.threadsafe!必须在 config.cache_classes之前出现.像这样对它重新排序以解决问题:

If anyone else has this problem the solution was the order: config.threadsafe! has to come before config.cache_classes. Reorder it like this to fix it:

...
config.threadsafe!
config.cache_classes = false
...

更新

这仅仅是因为 config.threadsafe!这样做:

def threadsafe!
  @preload_frameworks = true
  @cache_classes      = true
  @dependency_loading = false
  @allow_concurrency  = true
  self
end

有关线程安全的作用,请参见此处.

See here for what thread safety does.

这篇关于Rails:cache_classes =&gt;假仍然缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆