If you have worked on making a website, in this mobile age you have probably run into the issue of testing local code on external devices, such as your cell phone or tablet. I’ll show you a really quick way to all your Rails server to be exposed to other devices on your network.
– Ensure Both Devices are on the same network.
– Then start your rails server using the following command:
rails s -b 0.0.0.0
Next find your local ip:
Mac
This can be found in your System Preferences -> Network and will be shown in tiny print under the status of your connection.
Linux
Use ifconfig to find your address
ifconfig
If you’re lazy you can use this command to just give you back what you want.
ifconfig | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
Finally on your mobile browser and go to the url YOUR_IP:PORT
