Module: Rodauth::Rails::App::RequestMethods
- Defined in:
- lib/rodauth/rails/app.rb
Instance Method Summary collapse
-
#POST ⇒ Object
The Rack input might not be rewindable, so ensure we parse the JSON request body in Rails, and avoid parsing it again in Roda.
-
#redirect ⇒ Object
When calling a Rodauth method that redirects inside the Rails router, Roda’s after hook that commits the flash would never get called, so we make sure to commit the flash beforehand.
-
#rodauth(name = nil) ⇒ Object
Automatically route the prefix if it hasn’t been routed already.
Instance Method Details
#POST ⇒ Object
The Rack input might not be rewindable, so ensure we parse the JSON request body in Rails, and avoid parsing it again in Roda.
93 94 95 96 97 98 |
# File 'lib/rodauth/rails/app.rb', line 93 def POST if content_type =~ /json/ env["roda.json_params"] = scope.rails_request.POST.to_hash end super end |
#redirect ⇒ Object
When calling a Rodauth method that redirects inside the Rails router, Roda’s after hook that commits the flash would never get called, so we make sure to commit the flash beforehand.
103 104 105 106 |
# File 'lib/rodauth/rails/app.rb', line 103 def redirect(*) scope.rails_request.commit_flash super end |
#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.
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/rodauth/rails/app.rb', line 78 def rodauth(name = nil) prefix = scope.rodauth(name).prefix if prefix.present? && remaining_path == path_info on prefix[1..-1] do super pass end else super end end |