When my form gets posted, it will first create my model object#1, and if it succeeds, then it will create model object#2.
My form field needs to have a mix of both input fields for both model objects.
Can I do this using form helpers or should I just do this manually?
Update
Below are my models:
My models:
Account
has_many :users
has_one :primary_user, :class_name => 'User'
User
has_one :account
My user table has:
account_id
My account table:
primary_user_id
So during registration/signup for an account, I want to also include the fields from the user object:
user_name
email
password
So when the account is created, the primary_user user account is also created.
How can I do this?
PSS: Which side of the associate should be nullable, the account_id on the user table or the primary_user on the account side? Because currently I have no nulls on both sides and that won’t work!
Model code
Controller Code
View code