Skip to content

Error when using custom model #166

Answered by janko
wolfsblu asked this question in Q&A
Oct 10, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hi, thanks for posting the relevant code. I believe there is a circular dependency issue going on here:

  1. when the Rodauth middleware references RodauthApp, it starts loading rodauth_app.rb
  2. when rodauth_app.rb references RodauthMain, it starts loading rodauth_main.rb (at that point the Rodauth configuration hasn't yet been registered into the app)
  3. when rodauth_main.rb references the User model, it starts loading user.rb
  4. when user.rb includes the model mixin, the mixin tries to retrieve the Rodauth configuration in order to read table & column names
  5. since no configuration hasn't yet been registered, the code fails

Ideally, you should have received an error that the main configuration (nil)…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@wolfsblu
Comment options

Answer selected by wolfsblu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants