Skip to content

Instantly share code, notes, and snippets.

@cpappen
Last active November 7, 2017 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpappen/9018d4d87f5175e548cc286bd3a4f640 to your computer and use it in GitHub Desktop.
Save cpappen/9018d4d87f5175e548cc286bd3a4f640 to your computer and use it in GitHub Desktop.
binding ip 0.0.0.0 on rails 4.2.1 app
#config/boot.rb
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