Created
July 29, 2008 18:20
-
-
Save ggoodale/3137 to your computer and use it in GitHub Desktop.
Using a helper method in both a controller and a view.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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