Detecting iPhone in Rails
In environment.rb or, even better, a plugin:
module ActionController class AbstractRequest def iphone? self.env['HTTP_USER_AGENT'] =~ /iPhone/ ? true : false end end end
In our controller, we simply ask
request.iphone?
In environment.rb or, even better, a plugin:
module ActionController class AbstractRequest def iphone? self.env['HTTP_USER_AGENT'] =~ /iPhone/ ? true : false end end end
In our controller, we simply ask
request.iphone?