0

私は development.rb を cache_class ではないように設定しましたが、再度 ctrl+c して rails s を実行しない限り、binding.pry や puts を追加するなどの変更を行ったときに、まだキャッシュされ、更新されないのはなぜですか。

私は主にクラス EditorHub::ArticlesController で開発を行っていますが、名前空間が原因でしょうか?

なぜそれが起こるのですか?

rails s
=> Booting WEBrick
=> Rails 3.2.2 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server


#development.rb
CMS::Application.configure do
  config.cache_classes = false
end

#application.rb

config.autoload_paths += %W(#{config.root}/lib)
4

1 に答える 1

1

More details on the exact changes you made might be helpful, but in general, changes are made to Classes that are in your models folder should be reloaded on every request and your approach is correct. And changes to many other folders are in your load path so they'll also be reloaded, but not all. You can fix that by changing your load path, but that may be more work than simple ctrl-c and restarting.

I don't think this would work but you could put this in the class not reloading..

Rails.application.eager_load!

The issue is, you can definitely get the class to reload in development. The I generally find the effort to do so is not worth benefit.

于 2012-08-08T16:20:41.477 に答える