Testing a Rails Application in IE in Parallels and in Leopard
We just wrapped up a kick-awesome web app design and I learned a ton of new stuff, so I’m going to be posting some new tutorials. Most of this can be found elsewhere, but it’s usually in multiple places so I’m trying to consolidate it for you. Aren’t I a champ (see awful picture)?
Wait, I need to back up a sec. You’ll need to have rails installed and you’re going to have to use the terminal (scary, I know!). Usually what happens is you
cd (change directory) in to the folder on your hard drive where the application lives. For me this would be something like:
Then to start the Rails server:
Now that it’s running you go to http://localhost:3000 in your browser and viola! Test that web application.
Of course, if your running IE in Parallels this doesn’t work. It can’t read the 3000 port. You have to open it up. In Tiger, this was a lot easier (and led to much head scratching when I tried it in Leopard), but I finally figured it out. In the terminal, do this:
sudo ipfw add allow tcp from 3000 to 3099
This will open up ports 3000 to 3099 in your firewall! Astounding! Actually, you can open up however many you want, this is just in case you’re working on 99 rails apps at the same time (I’d peg the Less Everything guys for that).
So now that these ports are open, you can get to the application with your computer’s IP address plus the :3000. So for example, mine would be http://10.0.10.10/:3000 This .is all fine and good, but most people’s IP addresses are assigned by your router and change all the time. Plus, if you ever need to work on the project somewhere else it will change as well.
Enter your .local address. I use this address for all my web development for this very reason. I keep all my sites in the Sites folder and access them from something like this: http://jon-mbp.local/~homefolder/ You c.an find your short name in your web sharing preferences.
And there you have it! Test that rails app in IE to your heart’s content. And I seriously don’t claim to be an expert on this stuff, so if I’m dead wrong about something, let me know.