Search code examples
ruby-on-railsrubyruby-on-rails-pluginsmobile-website

Supporting Mobile Devices in Ruby on Rails


What is the best way to develop a rails application that has special views for different mobile devices? Basically I'm looking for something like this ASP.NET MVC solution: http://www.hanselman.com/blog/MixMobileWebSitesWithASPNETMVCAndTheMobileBrowserDefinitionFile.aspx


Solution

  • Two articles that use the iPhone as an example of serving up a different view based on a mobile sub-domain or a by detecting the user-agent. Essentially you'll create a different view using something like viewname.iphone.erb or viewname.mobile.erb and set the request.format variable to iphone or mobile respectively.

    iPhone subdomains with Rails

    iPhone on Rails - Creating an iPhone optimised version of your Rails site using iUI and Rails 2