Module: ActionController::ActiveDevice::ClassMethods
- Defined in:
- lib/active_device_rails.rb
Instance Method Summary collapse
-
#has_active_handset(test_mode = false) ⇒ Object
Add this to one of your controllers to use ActiveDevice.
- #in_mobile_view? ⇒ Boolean
- #is_device?(type) ⇒ Boolean
- #is_mobile_device? ⇒ Boolean
Instance Method Details
#has_active_handset(test_mode = false) ⇒ Object
Add this to one of your controllers to use ActiveDevice.
class ApplicationController < ActionController::Base
has_active_handset
end
You can also force mobile mode by passing in 'true'
class ApplicationController < ActionController::Base
has_active_handset(true)
end
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/active_device_rails.rb', line 22 def has_active_handset(test_mode = false) include ActionController::ActiveDevice::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 |
#in_mobile_view? ⇒ Boolean
40 41 42 |
# File 'lib/active_device_rails.rb', line 40 def in_mobile_view? @@in_mobile_view end |
#is_device?(type) ⇒ Boolean
44 45 46 |
# File 'lib/active_device_rails.rb', line 44 def is_device?(type) @@is_device end |
#is_mobile_device? ⇒ Boolean
36 37 38 |
# File 'lib/active_device_rails.rb', line 36 def is_mobile_device? @@is_mobile_device end |