Going through this process will allow you to use subdomains and bypass the requirement to use localhost:3000 as your domain in development mode in Rails.
The process for installing on a Mac is as follows:
You can run this command or view the instructions from the website.
Install the Powder Gem
This RubyGem automatically creates a symlink to pow for your app.
This will install the gem, after the gem has been installed, change into your application's root directory and run the command:
If everything is properly installed, the output should say:
Guide update from @jasonmclean, by linking the domain the server will automatically run, you don't have the need to run rails s, you can access your app from the URL shown above. If you need to restart the server, run the command touch tmp/restart.txt
Working with Subdomains
With the new development link working, now you can use subdomains in your application. To test this out, let's generate a controller:
Now open up the home.html.erb template and add the code:
Now start the rails server again and navigate to http://my-subdomain.<your-app-name>.dev/static/home and you should see whatever the subdomain you chose on the page. From this point you can access the value of the subdomain the same way that you'd use any parameter.
If you want to implement the same type of functionality on a Linux based system, you can leverage Prax.