Skip to content

Instantly share code, notes, and snippets.

@pseudomuto
Last active August 29, 2015 14:12
Show Gist options
  • Save pseudomuto/ae8810b6b47fb090f8a1 to your computer and use it in GitHub Desktop.
Save pseudomuto/ae8810b6b47fb090f8a1 to your computer and use it in GitHub Desktop.
Blog Code: Running Rails Inside Vagrant
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
# THIS IS THE NEW CODE
if ENV["RAILS_ENV"] == "development" || ENV["RAILS_ENV"].nil?
require "rails/commands/server"
module Rails
class Server
alias_method :original_default_options, :default_options
def default_options
original_default_options.merge(Host: "0.0.0.0")
end
end
end
end
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANT_IP = '192.168.211.39'
Vagrant.configure("2") do |config|
config.vm.box = ...
config.vm.box_url = ...
config.vm.network :private_network, ip: VAGRANT_IP
...
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment