class SupportSegment::MobileDetect::Middleware
the following sucks and it makes sense to be more in control of what routes you want to expose for the mobile experience
Public Class Methods
new(app)
click to toggle source
# File lib/support_segment/mobile_detect.rb, line 16 def initialize(app) @app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/support_segment/mobile_detect.rb, line 20 def call(env) begin request = Rack::Request.new(env) if request.host.match(/^m./) request.params[:format] = :mobile request.env["action_dispatch.request.formats"] = [Mime::Type.lookup_by_extension(:mobile)] end return @app.call(env) rescue => exception Rails.logger.fatal( "\n#{exception.class} (#{exception.message}):\n " + exception.backtrace.join("\n") + "\n\n" ) raise exception end end