Closed Bertg closed 2 years ago
Thanks for the feedback. There is this part in the documentation:
If you need to access Rodauth methods not exposed as internal requests, you can use Rodauth::Rails.rodauth to retrieve the Rodauth instance used by the internal_request feature
But it's obviously confusing, as it may appear to someone scanning the code that this is how internal_request feature should be used. I think first showing an example of regular internal_request usage might make it clearer. The example with Rodauth::Rails.rodauth
is really advanced usage if internal_request's class methods are not enough.
Indeed, it skipped over the "normal" use case all together. Combined with the terse docs of rodauth it got very confusing. Only after reading the code did it finally click for me.
Hi,
I just started using rodauth and rodauth_rails. I wanted to start using the internal_request feature and had a lot of issues getting it to work.
First, the documentation shows that
Rodauth::Rails.rodauth
should be used to make internal calls. However I figured out (from the tests) that it's actuallyRodauthApp.rodauth
that should be used.Also the usage of
:env
and alike is poorly explained. Again, according to the tests these should be added to the final call, like so:RodauthApp.rodauth.create_account(login: "user@example.com", password: "secret", env: env)
while the docs make it look like it should beRodauth::Rails.rodauth(env: env).create_account(login: "user@example.com", password: "secret")
.Not sure if I just "read i wrong" but its confusing for sure.