Module: Rodauth::Rails::App::RequestMethods

Defined in:
lib/rodauth/rails/app.rb

Instance Method Summary collapse

Instance Method Details

#rodauth(name = nil) ⇒ Object

Automatically route the prefix if it hasn’t been routed already. This way people only have to update prefix in their Rodauth configurations.



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/rodauth/rails/app.rb', line 73

def rodauth(name = nil)
  prefix = scope.rodauth(name).prefix

  if prefix.present? && remaining_path == path_info
    on prefix[1..-1] do
      super
      pass # forward other {prefix}/* requests downstream
    end
  else
    super
  end
end