Skip to content

Instantly share code, notes, and snippets.

@dillonhafer
Created May 28, 2017 22:20
Show Gist options
  • Save dillonhafer/8f24f51ab26e5dbb340eda58361f913a to your computer and use it in GitHub Desktop.
Save dillonhafer/8f24f51ab26e5dbb340eda58361f913a to your computer and use it in GitHub Desktop.
Get the development server host and port in Rails 3,4,5
# Rails 5.1
require 'rails/commands/server/server_command'
# Rails 5.0
require 'rails/commands/server'
def __host_and_port__
options = Rails::Server::Options.new.parse!(ARGV)
options.values_at(:Host, :Port)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment