I have a class People and class User (from Devise).
When someone signs up a user row(object) gets created in the User class(table).
I would also like the user.rb model to create a row(object) in the People class(table).
(The user.rb also has “has_one :person” in it.)
I tried the following without success:
after_create :create_person
protected
def create_person
self.create_person email: self.email
end
How could I code this?
But take care, if you want to update the person record when the corresponding user record is updated use
after_saveandPerson.find_or_create_by_email(self.email)