Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do i run a development rails app / website on an ipod

I have a app / site that i am running on my local imac and i want to test it on my ipad browser.

Can connect to my imac localhost rails app throught the wifi with my ipad ? If so how!! ?

My app is a multi tenant app that uses subdomains and so i use the hosts file on my my to point for example achme.mycompany.dev to localhost.

How do i do this on the ipad to goto achme.mycompany.dev in the browser and it runs the local app on my imac ?

Hope this all makes sense! Please help.

best regards Rick

like image 494
Rick Moss Avatar asked May 16 '12 15:05

Rick Moss


People also ask

How do I run the rails app?

Go to your browser and open http://localhost:3000, you will see a basic Rails app running. You can also use the alias "s" to start the server: bin/rails s . The server can be run on a different port using the -p option. The default development environment can be changed using -e .

Can you make an app with Ruby?

Thanks to RubyMotion, your Ruby developers can write iOS and Android apps, today. Ruby makes programmers happy and productive, and by sharing the same language across platforms you get to reuse code, save time, and ship faster.


2 Answers

I am hoping that your macbook and iPad are on same network. Now go to "Open network preference". Check screenshot.

You will see an ip.

enter image description here

then from ipad open: your_ip:3000

like image 154
Mohit Jain Avatar answered Oct 06 '22 00:10

Mohit Jain


I'm providing an update for anyone who's using Rails 4, has followed the steps in the accepted answer, and still can't connect to the app via development_machine_ip:3000. The reason being that somewhere around version 4, Rails changed the default binding address from 0.0.0.0 to only localhost. By default this allows you to only access the Rails app via localhost:3000 or 127.0.0.1:3000 - which is fine in most cases.

Now if you'd like to access the app from a different device on your network, you can use the -b option when starting the server and specify a binding address of 0.0.0.0

rails s -b 0.0.0.0

This will bind on ALL interfaces including localhost and the IP assigned by your network. You should now be able to access the app via development_machine_ip:3000.

like image 32
Bart Jedrocha Avatar answered Oct 06 '22 01:10

Bart Jedrocha