Skip to content

Instantly share code, notes, and snippets.

@bungard
Created January 23, 2015 20:12
Show Gist options
  • Save bungard/1e709ac721090ad39425 to your computer and use it in GitHub Desktop.
Save bungard/1e709ac721090ad39425 to your computer and use it in GitHub Desktop.
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
@bungard
Copy link
Author

bungard commented Jan 23, 2015

This may have some inherent issues depending on the system, but worked on a couple of my machines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment