A simple way to build iPhone specific interface with Rails
- 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
4 comments:
September 23, 2007 at 11:19 AM
huh nice,
only what we need is to have iphone in israel :)
400$ on ebay, unlocked for any gsm
November 25, 2007 at 9:30 PM
What you really want to check for here is mobile safari, not the iPhone as such. Mobile safari is used on both the iPhone and the iPod touch.
Details are here.
June 5, 2008 at 1:15 AM
We all know Apple iPhone is very rich in multimedia features including Internet capabilities... and of course the price isn't affordable to the average people...
So if you own this Gadget I think it's better to have an extra care specially the screen, it needs Incase iPhone Slider Case to protect your iPhone from unwanted scratch.
This is only an advice... don't think it seriously if you don't want.
Peace!
June 5, 2008 at 5:56 AM
That's right.
i don't really think it's too expensive, but still, it is one of the best things i purchased.
Post a Comment