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

Namespaced model classes #69

Closed
tcannonfodder opened this issue Nov 22, 2023 · 4 comments
Closed

Namespaced model classes #69

tcannonfodder opened this issue Nov 22, 2023 · 4 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@tcannonfodder
Copy link
Collaborator

👋 What's the convention for accessing model classes that are namespaces?

For example; I have Administrator and Administrator::Passkey as 2 ActiveRecord models.

(rdbg) administrators
#<struct Oaken::Stored::ActiveRecord
 type=
  Administrator(id: integer, email: string, webauthn_id: string, sign_in_count: integer, current_sign_in_at: datetime, last_sign_in_at: datetime, current_sign_in_ip: string, last_sign_in_ip: string, created_at: datetime, updated_at: datetime),
 key="administrators">
(ruby) administrator_passkeys
eval error: undefined local variable or method `administrator_passkeys' for Oaken::Seeds:Module
  /Users/tcannon/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/oaken-0.5.0/lib/oaken/seeds.rb:14:in `method_missing'
  (rdbg)/db/seeds/administrators/default.rb:1:in `block in load_onto'
nil

Thanks!

@tcannonfodder tcannonfodder added documentation Improvements or additions to documentation question Further information is requested labels Nov 22, 2023
@elvinaspredkelis
Copy link

Super interested in this as well!

@kaspth
Copy link
Owner

kaspth commented Apr 25, 2024

Ah yeah, I just told @tcannonfodder privately and forgot to reply here.

Right now, you have to call register Administrator::Passkey because we don't auto-detect namespaces.

So we could use documentation for this, until I get to the auto-detection.

@kaspth
Copy link
Owner

kaspth commented Apr 25, 2024

Oh and I recommend calling register in Oaken.prepare in db/seeds.rb.

@kaspth
Copy link
Owner

kaspth commented Jun 30, 2024

Just auto-fixed this in #83.

@kaspth kaspth closed this as completed Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants