I found another way to do this. Just create a bin/server
executable file in your Rails project with the following content:
#!/bin/bash
# This starts webrick using rerun which automatically restarts it after critical config files are changed
rerun --pattern '{Gemfile.lock,config/environment.rb,config/environments/development.rb,config/initializers/*.rb,lib/**/*.rb}' --no-growl --signal INT --background --clear -- rails s
Then install the rerun gem: gem install rerun
.
Now simply start webrick by typing server
(instead of rails server
) and rerun will take care of restarting the server whenever an important file is changed.