Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (34 sloc) 3.43 KB

Rails Mobile Solutions Roundup

To get started, if you're not sure where to begin or as a review, take a look at this round up of mobile solutions:

  1. The tutorial "How to Build a Mobile Rails 3.1 App" demonstrates -- although slightly dated from the gem -- how to use the authors mobylette and jquery_mobile_rails gems. Mobylette handles requests and allows your controller to respond with a :mobile format, while jquery-mobile-rails adds jQuery Mobile files to your asset pipeline: which helps make everything look great and work like a native mobile app.

  2. Much like mobylette, mobile-fu detects mobile requests and allows your application to respond with a :mobile format.

  3. There is a rack-based detection solution called mobvious:

    Mobvious detects whether your app / website is being accessed by a phone, or by a tablet, or by a personal computer. You can then use this information throughout your app. (E.g. fork your front-end code with regard to device type. There is a plugin for Ruby on Rails that helps you with this.)

    The mobvious-rails gem allows you to:

    Access detected device type easily from controllers and views.
    Execute code for given device types only. Both in controllers and views.
    Do the above stuff also in your CoffeeScript.

  4. Ryan Bates screencast "Mobile Devices" will teach you how to roll your own user agent detector.

  5. In the tutorial "Mobile Devices and Rails: Maintaining your Sanity" the author proposes placing mobile templates in a separate directory, then when requests come in from a mobile subdomain, like m.domain.com, these templates are served. If the templates are not available, the requester is served regular view templates; freeing you up from having to create two templates for every action. Users can switch between the two templates, and user agent detection is employed.

  6. If you're looking to beef up your detection capabilities, the following services are available (includes free and paid plans).

  7. You can also tap into the WURFL database.

  8. Here is a list of "Mobile Browser ID (User-Agent) Strings" you could incorporate into your project if you wanted to get granular.