Given the following pseudo-code:
Company
has_many :jobs
Job
belongs_to :company
I'm creating a form to post a new job. In the form, I want to have two fields for an optional company. On submission, if a company was entered, I want to either create or update the company and associate it with the new job. I know if the company exists by searching the companies table for the company's url.
Is it possible to do this using form_for, fields_for, and accepts_nested_attributes_for
given the company may not exist?