We've moved discussions to Discord

Account accepts_nested_attributes && acts_as_tenant(:account) for user

Matt Bjornson
I keep going back and forth on this....

I'm building a product.(that hopefully) has many users from an account. The default that user would have acts_as_tenant(:account). 
class User < ApplicationRecord
  acts_as_tenant(:account)
  ...
end
class Account < ApplicationRecord
  accepts_nested_attributes_for :users
  has_many :users
end

For the first user of an account, I'd like them to signup also with the account name, and be considered the admin for that account. But I'm also thinking of a personal plan that would leverage the personal account. I've implemented account accepts_nested_attributes_for :users using Devise before in the past, and will implement that, but for the personal scenario, thoughts on how to do this?
Chris Oliver
I just added a screencast on adding the Account to sign up to the docs.

You could have this also create the personal account as part of registration if you wanted. Up to you.
Matt Bjornson
Chris Oliver  that is awesome, much simpler than the solution I was thinking about have done in the past. Thank you!!!
Matt Bjornson
@ Chris Oliver  A related question, when inviting someone, I'd like to invite them to my tenant. But when I added the above code, the tenant information isn't either 1) prepopulated in the Account Name or 2) that field is hidden. Any pointers, I've been digging through the code, and haven't quite figured that out.
Chris Oliver
Matt Bjornson  I'm not sure what you mean exactly. This code doesn't affect invitations. The account name listed on registration is for the user's default account.
Notifications
You’re not receiving notifications from this thread.