Created
January 23, 2015 20:12
-
-
Save bungard/1e709ac721090ad39425 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'rails/commands/server' | |
require 'socket' | |
module Rails | |
class Server | |
alias :default_options_alias :default_options | |
def default_options | |
ip_addr_list = Socket.ip_address_list | |
#puts ip_addr_list.inspect | |
if ip_addr_list.count >= 2 | |
ip = ip_addr_list[1].ip_address | |
else | |
ip = ip_addr_list[0].ip_address | |
end | |
default_options_alias.merge!(:Host => ip) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This may have some inherent issues depending on the system, but worked on a couple of my machines.