Class: Rodauth::Rails::Middleware
- Inherits:
-
Object
- Object
- Rodauth::Rails::Middleware
- Defined in:
- lib/rodauth/rails/middleware.rb
Overview
Middleware that’s added to the Rails middleware stack. Normally the main Roda app could be used directly, but this trick allows the app class to be reloadable.
Instance Method Summary collapse
-
#asset_request?(env) ⇒ Boolean
Check whether it’s a request to an asset managed by Sprockets or Propshaft.
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
7 8 9 |
# File 'lib/rodauth/rails/middleware.rb', line 7 def initialize(app) @app = app end |
Instance Method Details
#asset_request?(env) ⇒ Boolean
Check whether it’s a request to an asset managed by Sprockets or Propshaft.
23 24 25 26 27 |
# File 'lib/rodauth/rails/middleware.rb', line 23 def asset_request?(env) return false unless ::Rails.configuration.respond_to?(:assets) env["PATH_INFO"] =~ %r(\A/{0,2}#{::Rails.configuration.assets.prefix}) end |