I have two models, let’s call them Company and User. A company
user and a user has_one company (for now, may has_many latter).
using one form to create both a user and a company at the same time, so
and then I do:
@company = Company.new params[:company]
@company.user = User.new params[:user]
Be sure to call user.valid? in your action if the company fails so that
error messages for the user is actually generated.
<%= error_messages_for :company, :user %>