Return to Snippet

Revision: 3593
at August 18, 2007 23:53 by ctran


Initial Code
class ApplicationController < ActionController::Base
  exempt_from_layout('iphone_html.erb')
  
  before_filter :check_iphone
  
  protected
  def iphone?
    request.user_agent.include?('iPhone')
  end
  
  def check_iphone
    if iphone?
      request.parameters[:format] = 'iphone_html'
    end
  end
end

class DashboardController < ApplicationController
  def index
    @top_movies = Movie.top_movies
    @movie = @top_movies.first
    
    respond_to do |format|
      format.html # index.html.erb
      format.iphone_html #index.iphone_html.erb
    end
  end
end

Initial URL

                                

Initial Description
A simple way to build iPhone specific interface with Rails

Initial Title
iPhone on Rails

Initial Tags
iphone

Initial Language
Ruby