Module: MobileFu::ActionController::ClassMethods

Defined in:
lib/mobile_fu/controller_methods.rb

Instance Method Summary collapse

Instance Method Details

#enable_mobile_fuObject



38
39
40
41
42
43
44
# File 'lib/mobile_fu/controller_methods.rb', line 38

def enable_mobile_fu
  include InstanceMethods
  
  helper_method :is_mobile_device?
  helper_method :in_mobile_view?
  helper_method :is_device?
end

#has_mobile_fu(test_mode = false) ⇒ Object

Add this to one of your controllers to use MobileFu.

class ApplicationController < ActionController::Base 
  has_mobile_fu
end

You can also force mobile mode by passing in ‘true’

class ApplicationController < ActionController::Base 
  has_mobile_fu(true)
end


24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/mobile_fu/controller_methods.rb', line 24

def has_mobile_fu(test_mode = false)
  include InstanceMethods

  if test_mode 
    before_filter :force_mobile_format
  else
    before_filter :set_mobile_format
  end

  helper_method :is_mobile_device?
  helper_method :in_mobile_view?
  helper_method :is_device?
end