

IPhone Web Development with Ruby on Rails - marcofloriano
http://www.devx.com/wireless/Article/35532

======
rufo
Searching for just the iPhone UA locks out other mobile WebKit-based browsers
that may prefer an iPhone page, such as Android and the Pre. Even if you do
want to serve just iPhone users, I think you'd be better off adding a new mime
type and serving that.

Also, there's an onorientationchange event on the window object you can listen
for, which would be much more efficient than firing a timer every 200ms.

This article (while a bit old) I think does a better job of showing you should
go about writing an iPhone-friendly interface with Rails:
[http://www.slashdotdash.net/2007/12/04/iphone-on-rails-
creat...](http://www.slashdotdash.net/2007/12/04/iphone-on-rails-creating-an-
iphone-optimised-version-of-your-rails-site-using-iui-and-rails-2/)

~~~
hopeless
That article is no older than the one linked! There's also a rails plugin that
can serve mobile views to various mobile browsers including opera mobile.
Sorry, on mobile at the moment and I can't remember the name but try searching
github.

~~~
rufo
You're right, it wasn't the newest example, but I didn't say it was newer - I
mainly thought it was an example of better Rails design and development than
the linked article. (Why should the controller be concerned at _all_ with what
orientation the phone is in? That's a client-side view concern, not the
controller's... unless you're loading additional content, in which case you
should load that content, not ping back to the server with a new width. I'm
also not clear why you'd add an attribute to body for reformatting the page
when you could just add a class.)

I think this is the extension you're referring to - a cursory glance looks
good to me: <http://github.com/brendanlim/mobile-fu/tree/master>

~~~
hopeless
Mobile_fu. You're right! I used it briefly on a site before removing the
functionality as I didn't really need it.

------
jasongullickson
Very cool little article.

Apple's introduction to Rails development touches on this subject but
something more detailed yet still concise is greatly appreciated.

------
dugmartin
Developers: if you expose an iPhone view of your site that reduces what
content you show versus your main site _please_ allow me to opt-out of it via
a long term cookie. Facebook's native app on the iPhone is still a little
buggy so I often load the site up via Safari and _every_ time I have to scroll
to the bottom and select "View Full Site".

------
marcofloriano
People, i´m building an online VOIP app with ruby and i want to extend this
app for iphone users. So i need any information on how to make the web app
available on iphones (in the future, for any cellphones). The best that i get
so far was this one. Any tips ?

~~~
joepestro
I assume you need access to iPhone hardware features (microphone, etc).
Unfortunately, you can't do that through mobilesafari.

Check out the iPhone SDK for more info: <http://developer.apple.com/iphone/>

