Class: Rodauth::Rails::App
- Inherits:
-
Roda
- Object
- Roda
- Rodauth::Rails::App
- Defined in:
- lib/rodauth/rails/app.rb
Overview
The superclass for creating a Rodauth middleware.
Defined Under Namespace
Modules: RequestMethods
Class Method Summary collapse
- .configure(*args, **options, &block) ⇒ Object
-
.controller_path ⇒ Object
The newrelic_rpm gem expects this when we pass the roda class as :controller in instrumentation payload.
- .rodauth!(name) ⇒ Object
Instance Method Summary collapse
Class Method Details
.configure(*args, **options, &block) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rodauth/rails/app.rb', line 24 def self.configure(*args, **, &block) auth_class = args.shift if args[0].is_a?(Class) name = args.shift if args[0].is_a?(Symbol) fail ArgumentError, "need to pass optional Rodauth::Auth subclass and optional configuration name" if args.any? auth_class ||= Class.new(Rodauth::Rails::Auth) plugin :rodauth, auth_class: auth_class, name: name, csrf: false, flash: false, json: true, **, &block # we need to do it after request methods from rodauth have been included self::RodaRequest.include RequestMethods end |
.controller_path ⇒ Object
The newrelic_rpm gem expects this when we pass the roda class as :controller in instrumentation payload.
66 67 68 |
# File 'lib/rodauth/rails/app.rb', line 66 def self.controller_path name.underscore end |
.rodauth!(name) ⇒ Object
60 61 62 |
# File 'lib/rodauth/rails/app.rb', line 60 def self.rodauth!(name) rodauth(name) or fail ArgumentError, "unknown rodauth configuration: #{name.inspect}" end |
Instance Method Details
#flash ⇒ Object
48 49 50 |
# File 'lib/rodauth/rails/app.rb', line 48 def flash rails_request.flash end |
#rails_request ⇒ Object
56 57 58 |
# File 'lib/rodauth/rails/app.rb', line 56 def rails_request ActionDispatch::Request.new(env) end |
#rails_routes ⇒ Object
52 53 54 |
# File 'lib/rodauth/rails/app.rb', line 52 def rails_routes ::Rails.application.routes.url_helpers end |