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

后端 未结 5 1386
北海茫月
北海茫月 2021-01-04 08:19

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 wit

5条回答
  •  情歌与酒
    2021-01-04 09:00

    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.

提交回复
热议问题