需要重启Puma以反映视图中的变化吗?

时间:2015-08-13 10:37:24

标签: ruby-on-rails puma

我刚刚对我新部署的Rails 4应用程序进行了一些新的更改。更准确地说,视图文件中的一些更改。

令我沮丧的是,在推动更改之后,网站仍然显示了相同的旧观点。我调查了很多,最后我意识到解决问题的关键是:

sudo restart puma-manager

现在,这是正常做法吗?每次推送更改时重新启动服务器?或者我没有正确配置Puma?

有人可以告诉我,我是否可以做些什么来改善这种状况?

1 个答案:

答案 0 :(得分:3)

Rails中的

自动更新代码在机架中间件ActionDispatch::Reloader下工作。

  

默认情况下,ActionDispatch::Reloader包含在中间件中   仅在开发环境中堆栈。

请求命中服务器时。中间件ActionDispatch::Reloader启动,并执行插入的回调。

例如:

=> bundle exec rake middleware RAILS_ENV=development
use Rack::Sendfile
use ActionDispatch::Static
use Rack::Lock
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x00000004b662b0>
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use Rollbar::Middleware::Rails::RollbarMiddleware
use ActionDispatch::RemoteIp
use ActionDispatch::Reloader #< -- here reloader!
use ActionDispatch::Callbacks
use ActiveRecord::Migration::CheckPending
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
use Warden::Manager
run MyApp::Application.routes

并且production中没有ActionDispatch::Reloader

=> bundle exec rake middleware RAILS_ENV=production
use Rack::Sendfile
use ActionDispatch::Static
use Rack::Lock
use #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x00000004092e60>
use Rack::Runtime
use Rack::MethodOverride
use ActionDispatch::RequestId
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::DebugExceptions
use Rollbar::Middleware::Rails::RollbarMiddleware
use ActionDispatch::RemoteIp
use ActionDispatch::Callbacks
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
use ActionDispatch::Cookies
use ActionDispatch::Session::CookieStore
use ActionDispatch::Flash
use ActionDispatch::ParamsParser
use Rack::Head
use Rack::ConditionalGet
use Rack::ETag
use Warden::Manager
run MyApp::Application.routes