Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator fails when integrating with Devise #51

Open
gutschi opened this issue Mar 11, 2024 · 1 comment
Open

Generator fails when integrating with Devise #51

gutschi opened this issue Mar 11, 2024 · 1 comment

Comments

@gutschi
Copy link

gutschi commented Mar 11, 2024

After installation of the gem when I run the generator it fails.

rails generate trestle:auth:install AdminUser --devise

fails with

/app/app/admin/auth/admin_users_admin.rb:1:in `<top (required)>': uninitialized constant Auth (NameError)
Trestle.resource(:admin_users, model: AdminUser, scope: Auth) do

If I remove the , scope: Auth from the generated Trestle resource admin_users_admin.rb everything seems to work. Not sure what the Auth scope is supposed to do there though ...

Rails and gem versions:

  • rails (7.1.3.2)
  • devise (4.9.3)
  • trestle (0.9.8)
  • trestle-auth (0.4.4)
@spohlenz
Copy link
Member

spohlenz commented May 6, 2024

I've tried various things and unfortunately haven't been able to reproduce this (though I did uncover a couple of unrelated Rails 7.1 issues in the process).

My gut feel is that this is something to do with Zeitwerk -- the Auth module is an implicit module/namespace that is (or at least should be) created by having the trestle-auth resources within the app/admin/auth folder.

I assume that you have created a Devise AdminUser model already (otherwise I'd expect to see "uninitialized constant AdminUser"). If you are still experiencing this issue, you could please also share your versions of Ruby and Zeitwerk, as well as if you have any customized autoloading configuration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants