1

I just pushed some new changes to my newly deployed Rails 4 app. More precisely some changes in the view file.

To my desmay, after pushing the changes, the website still showed the same old view. I investigated quite a bit, and in the end I realized that the key to solving the issue was:

sudo restart puma-manager

Now, is this a normal practice? Restarting the server every time changes are pushed? Or did I configure Puma unproperly?

Can someone tell me if there is something I can do to improve this situation?

Enrique Moreno Tent
  • 24,127
  • 34
  • 104
  • 189
  • Yes, for every push I also need to restart the server to see the changes.. If you use Capistrano, there also people write puma restart task. – Arup Rakshit Aug 13 '15 at 10:47

1 Answers1

4

autoupdate code in Rails works under the rack middleware ActionDispatch::Reloader.

By default, ActionDispatch::Reloader is included in the middleware stack only in the development environment.

When request hits the server. The middleware ActionDispatch::Reloader kicks in, and executes callbacks inserted.

For example:

=> 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

and in production have no 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
Roman Kiselenko
  • 43,210
  • 9
  • 91
  • 103