Mobile devices testing via local network

In many scenarios we want to test our rails app in mobile devices, tablets or smartphones.

If we are using the rails build-in rails server, we can access the app on mobile device under the same local network with the <local_ip>:3000.

The yourapp.dev, however, is only available in the development machine because it modifies the /etc/hosts file. We can’t access it from mobile devices.

Pow comes with a custom DNS server called xip.io – also from 37signals. It is made to make pow-powered rails app accessible through local network.

Xip.io

It comes from pow without any configuration needs. Just open the mobile browser in the device and type in the URL in the following format.

1http://<pow site name>.<dev machine IP>.xip.io

For instance, the develop machine is at 10.0.0.3 and the rails app is registered as “gallery” in pow.

In local, we access the app through http://gallery.dev.

In mobile device, we use http://gallery.10.0.0.3.xip.io.

Again, you can have multiple devices testing multiple rails app at the same time.

What’s next? We’re going to take a look at “Deployment database config”.

overlaied image when clicked on thumbnail

Makzan | Ruby on rails 101 | Table of Content