Module: MobileEnhancements::RouteHelpers

Defined in:
lib/mobile_enhancements/route_helpers.rb

Instance Method Summary collapse

Instance Method Details

#mobile_only(&block) ⇒ Object

all routes defined within the mobile_only block will require the mobile prefix



7
8
9
# File 'lib/mobile_enhancements/route_helpers.rb', line 7

def mobile_only(&block)
  scope(mobile_path_prefix, mobile: mobile_path_prefix, &block)
end

#mobile_optional(&block) ⇒ Object

all routes defined within the mobile_optional block will be accessible with and without the mobile prefix



13
14
15
16
17
18
# File 'lib/mobile_enhancements/route_helpers.rb', line 13

def mobile_optional(&block)
  scope("(:mobile)", {
    defaults: { mobile: nil },
    mobile: /(#{mobile_path_prefix})?/
  }, &block)
end