Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Merb plugin that sets content_type to :mobile if user agent is a mobile phone.

tree: b3094f6022

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.markdown

merb_mobile

Merb plugin that sets content_type to :mobile if user agent is a mobile phone.

To activate, just add the following in your controller:

MyController << Merb::Controller
  serves_mobile
end

...and any request from a mobile phone will be rendered by a mobile template. In addition to your action.html.erb/action.html.haml templates, you can use action.mobile.erb/action.mobile.haml templates.

If you want to always serve a mobile template regardless of the user agent (suitable for testing, perhaps), you can pass true to serves_mobile:

MyController << Merb::Controller
  serves_mobile(true)
end

...and all requests will use your mobile templates.

Inspired by hassox's content_type tutorial and mobile-fu for rails.

Something went wrong with that request. Please try again.