Files
fizzy/app/models/identity/joinable.rb
T
2025-12-03 13:29:20 +01:00

14 lines
312 B
Ruby

module Identity::Joinable
extend ActiveSupport::Concern
def join(account, **attributes)
attributes[:name] ||= email_address
transaction do
account.users.find_or_create_by!(identity: self) do |user|
user.assign_attributes(attributes)
end.previously_new_record?
end
end
end