Replies: 2 comments
-
You could have a UserPackageRole model for the table. Then you could have a one to many association in User, Package, and Role to that model. That might make certain things easier. However, what you have doesn't look bad. There is nothing wrong with referencing DB inside your model. If you don't want to reference the constant, you could use db, which is the model's database. |
Beta Was this translation helpful? Give feedback.
0 replies
-
As always, thanks for your prompt reply!On 19. Jul 2024, at 16:18, Jeremy Evans ***@***.***> wrote:
You could have a UserPackageRole model for the table. Then you could have a one to many association in User, Package, and Role to that model. That might make certain things easier. However, what you have doesn't look bad.
There is nothing wrong with referencing DB inside your model. If you don't want to reference the constant, you could use db, which is the model's database.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a DB schema, where
User
,Package
andRole
interact in the following way:What I would like to do, is write something like the following:
The closest I could come up with, is the following:
This feels a little clunky to reference
DB
inside the model. Does anyone know of a better way to handle this? I was looking at thecondition
intomany_to_many
, but couldn't quite make that work.Beta Was this translation helpful? Give feedback.
All reactions