Skip to content

Instantly share code, notes, and snippets.

@ggoodale
Created July 29, 2008 18:20
Show Gist options
  • Save ggoodale/3137 to your computer and use it in GitHub Desktop.
Save ggoodale/3137 to your computer and use it in GitHub Desktop.
Using a helper method in both a controller and a view.
class ApplicationController
protected
def iphone?
request.class.to_s.include?("CgiRequest") && request.user_agent.include?('iPhone')
end
end
class ApplicationHelper
def iphone?
@controller.send(:iphone?)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment