Skip to content

Instantly share code, notes, and snippets.

@CameronGilroy
Created April 10, 2011 12:15
Show Gist options
  • Save CameronGilroy/912293 to your computer and use it in GitHub Desktop.
Save CameronGilroy/912293 to your computer and use it in GitHub Desktop.
def mobile?
if session[:mobile_param]
session[:mobile_param] == "1"
else
request.user_agent =~ /Mobile|webOS/
end
end
helper_method :mobile?
def mobile_format
session[:mobile_param] = params[:mobile] if params[:mobile]
if mobile?
if request.format == :js
request.format = :mobilejs
else
request.format = :mobile
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment