Module: Mobylette::RespondToMobileRequests

Extended by:
ActiveSupport::Concern
Defined in:
lib/mobylette/respond_to_mobile_requests.rb

Overview

Defines the behavior for responding to mobile requests with a different view.

By including this to a controller, it will automaticaly look for a .mobile view instead of a .html, when the request comes from a mobile device.

Usage:

class AppicationController < ActionController::Base
  include Mobylette::RespondToMobileRequests
end

You can define some options:

class...
  include Mobylette::RespondToMobileRequests
  mobylette_config do |config|
    config[:fall_back] = :html
    config[:skip_xhr_requests] = false
    config[:mobile_user_agents] = proc { /iphone/i }
  end
  ...
end

note: By default it will already fall back to the :html format

Defined Under Namespace

Modules: ClassMethods