I have one big form, which ends up creating a User account, and completing part of it’s profile. So, User belongs_to Profile. The thing is, I’d like to set the profile to be filled as nested attributes, but only for this form. All other forms for the User model should not allow sending nested attributes for the profile. Is this possible? How?
I have one big form, which ends up creating a User account, and completing
Share
You can easily conditionally reject nested attributes based on the contents of the attributes by passing a
:reject_ifblock toaccepts_nested_attributes_for.For what you’re trying to achieve, I’d simply not accept nested attributes, and instead call
update_attributeson both the user and the profile in the controller action that is the target of the new user form.