I’m still implementing basic functionality in my app so I’m asking this now in case I need to re-think my design. My user interface in a “real browser” is a bunch of links which load data through AJAX. It also supports “normal non-AJAX” interaction. My controllers look somewhat like this:
if request.xhr?
render article
else
redirect_to article
This works very well so far and I have no problems. The problem is how I should add support for mobile apps. In the example above render article renders the file show.js.erb which looks like this:
$content.content("<%= escape_javascript(render "feeds/show") %>");
Obviously this won’t do in a mobile application where I won’t be working with a browser. I am thinkg of using phonegap to develop my app. I should note that I have zero experience with it.
So what I’m looking for is advice as how I should prepare support for a mobile application, any help is gladly appreciated. How should I be doing communication and are there anything special I should consider from hereon when I continue developing the backend?
There is an article about this. It’s been written a few years back and uses IUI and Rails 2. The conventions in this article still prove quite valid in later versions of Rails.
However, the concepts of what is needed to get you started is explained therein. It speaks of using an app called iPhoney, which helps in the debugging stages.
Second, the article explains how one would be able to configure Rails iPhone mime type and how to detect iPhone user agents, among other setups as well.
If you haven’t already. I would suggest looking at jQuery Mobile. Which may suit your requirements as well.
A more up-to-date article can be found here.