Last active
August 29, 2015 14:24
-
-
Save shilovk/61b4bba34f2dd5531c2f to your computer and use it in GitHub Desktop.
Change default_options for Rails::Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Override default options for server command | |
# This example changes default development host to 0.0.0.0 | |
require 'rails/commands/server' | |
module Rails | |
class Server | |
new_defaults = Module.new do | |
def default_options | |
default_host = Rails.env == 'development' ? '0.0.0.0' : '127.0.0.1' | |
super.merge( Host: default_host ) | |
end | |
end | |
# Note: Module#prepend requires Ruby 2.0 or later | |
prepend new_defaults | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment