Skip to content

Instantly share code, notes, and snippets.

@tubbo
Created May 10, 2010 20:41
Show Gist options
  • Select an option

  • Save tubbo/396503 to your computer and use it in GitHub Desktop.

Select an option

Save tubbo/396503 to your computer and use it in GitHub Desktop.
private
def mobile_device?
if session[:mobile_param]
session[:mobile_param] == '1'
else
request.user_agent =~ /Mobile|webOS/
end
end
helper_method :mobile_device?
def prepare_for_mobile
session[:mobile_param] = params[:mobile] if params[:mobile]
format :mobi if mobile_device?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment