We've moved discussions to Discord

New Person after creating account user

Daryl Haines
I have a Person model which belongs to Account and AccountUser. Users can create people who do not have a user account, but I want create an associated Person account each time a new AccountUser is created.
The idea is that users can assign a project owner to to a person within their account even if they don't have a user account.

I've tried the following but the new person record doesn't get inserted into the db:

account_user.rb
class AccountUser < ApplicationRecord
  after_create :new_accountperson
  
  private
  def new_accountperson
    Person.create(account_user_id: user_id, account_id: account_id)
  end
end

person.rb
class Person < ApplicationRecord
  acts_as_tenant :account

  belongs_to :account
  belongs_to :account_user
end

I've also tried Person.new then Person.save but that doesn't work either. I know I'm missing something simple, but what?
Notifications
You’re not receiving notifications from this thread.