We've moved discussions to Discord

Dont create accounts for invited users?

Cody Norman
Is it possible to invite users to an existing Account (like an employee) without creating an additional account?  All resources and objects will be shared under a single account and can't think of a use case on our end for needing accounts down the road.  So far, the only thing having multiple accounts has accomplished is confusing users
Chris Oliver
Hey Cody, if the user signs up through an invitation, it doesn't create a new account for them, just adds them to the one they join.

If you have personal accounts enabled, it will create one of those since every user should have a personal account.
Cody Norman
Thanks for the help, Chris.  I think I was able to get around the issue with commenting out the after_create callback in UserAccounts at 

app/models/concerns/user_accounts.rb#13

Thanks for the help and following up on this
Jason Ackerman
Cody Norman Thanks for this! As far as I can tell, this worked for me as well (in terms of not creating a second account for invited users). Did you have any side effects of commenting out that callback? From what I can tell, the only issue was that two tests in account_test.rb failed, but that's not a big deal. Any other issues you ran into? Thanks!

Chris Oliver do you endorse Cody's method here, or should this work without having to remove this callback? Will removing the callback affect anything else negatively? Thanks!
Chris Oliver
As long as the user at least one account, it should be fine.
Chris Oliver
I think one solution we could do here is:

after_create :create_default_account, if: ->{ accounts.none? }

That would make it so the default account wouldn't be created if you accepted an invitation since you'd already be in an account. And it would still create one for new users otherwise.
Karl Bishop
Just seen this answers one of my questions (scenario 2). If personal accounts are switched on, is it possible to create a personal account for the first user on a shared account? At the moment the first user does not have a personal account which leads to a 500 error if they try to edit their username (see my scenario 1).

EDIT - Oops, my bad: I didn't notice the timestamps on this thread when I posted here. Thought it was a brand new topic 😅
Matthias Orgler
I'm interested in the same scenario (scenario 2): How can I ensure that the first user of an account will also get a personal account? From the settings in JSP it sounds like "Enable Personal Accounts" should always create a personal account for a user.

And in addition to this question: How could a user add a personal account after the fact, if it hadn't been created upon signup?
Matthias Orgler
Answering my own question:

It seems the only difference between personal and regular accounts is the "personal" flag. So to let users create a personal account after the fact, I think I could simply provide a special account form with a hidden field of "personal=true". Haven't tried it, but it sounds logical.

Accounts can definitely be confusing – both to developers and customers. My hunch is that less is more: the fewer accounts a user has when they get to know my app, the better. So depending on the most common use case I will either start a user off with ONE personal account (and nothing else) or ONE general account (and nothing else). Throwing two accounts at them from the start doesn't seem to be good from an onboarding point of view.
Notifications
You’re not receiving notifications from this thread.