Is my Account system correct?
This is my first time using an
I'm trying to make it so that each user can create a new
I created the
I'm trying to set this up in a way where the
I also realized that I haven't done anything directly through
Am I missing something here? Am I taking the right approach or is there a different way I should be implementing this?
Thanks!
Account
system within a Devise system for User
models.I'm trying to make it so that each user can create a new
Account
and that new Account
will be tied to a Company
. I created the
Company
scaffold and have the Company
model set so that each Company
belongs_to :account
. In the migration file, the Company
references the :account_id
and the :user_id
(i.e. the User who created the account so I can distinguish who the admin of that particular Account/Company will be). I'm trying to set this up in a way where the
User
can have multiple accounts, and each Account
represents a different Company
. This way, each `User` can be charged by the number of companies they want to manage in one account.I also realized that I haven't done anything directly through
AccountUser
.Am I missing something here? Am I taking the right approach or is there a different way I should be implementing this?
Thanks!
Since you'd like to have multiple Companies in a single account, it sounds like you're on the right track.
Account - has_many :companies
Company - belongs_to :account
AccountUser would still be useful to share an account with other users so they could manage the companies together
Then your account can set the
Account - has_many :companies
Company - belongs_to :account
AccountUser would still be useful to share an account with other users so they could manage the companies together
Then your account can set the
quantity
on the subscription to current_account.companies.count
Notifications
You’re not receiving notifications from this thread.