Skip to content

Instantly share code, notes, and snippets.

@shilovk
Last active August 29, 2015 14:24
Show Gist options
  • Save shilovk/61b4bba34f2dd5531c2f to your computer and use it in GitHub Desktop.
Save shilovk/61b4bba34f2dd5531c2f to your computer and use it in GitHub Desktop.
Change default_options for Rails::Server
# 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