New entries from foreign controller

I have a situation that I can't seem to find an answer for. I have a view for a new "report" I want it to be possible for the user to input a company name and location if they aren't already in the list of "known" values and when the form is submitted I want those manual entries added to their respective tables at the same time the report is added.

How would I go about doing this? I've tried creating new_company and new_location fields in the view and looking for them in the controller but they are never set in the params hash.

Below is the relevant code:


def create     @report =[:report])

    # If they entered a location that wasn't listed we need to add it     if params[:new_location]       @location = = params[:new_location][0]       @location.region = params[:new_location][1] = params[:new_location][2]     end

    # Similar to above but if they entered a company that wasn't lited     if params[:new_company]       @company = = params[:new_company]       if params[:new_location]         @company.location_id =       end     end

    # And again for a new position     if params[:new_position]       @position = = params[:new_position]       if params[:new_company]         @position.company_id = @company       end     end

    if       flash[:notice] = params.to_s       redirect_to :action => 'list'     else       render :action => 'new'     end   end


<p>   <label for="report_title">Title</label><br />   <%= text_field 'report', 'title' %> </p>

<p>   <label for="report_company_id">Company:</label>   <select id="company_id", name="company_id">     <%= options_from_collection_for_select(@companies, :id, :name, @selected) %>   </select> </p>

<p>   <label for="report_new_company">Other:</label>   <%= text_field 'report', 'company_id' %> </p>

<p>   <label for="report_position_id">Position:</label>   <select id="position_id", name="position_id">     <%= options_from_collection_for_select(@positions, :id, :name, @selected) %>   </select> </p>

<p>   <label for="report_new_position">Other:</label>   <%= text_field 'report', 'position_id' %> </p>

<p>   <label for="report_category_id">Category:</label>   <select id="category_id", name="category_id">     <%= options_from_collection_for_select(@categories, :id, :name, @selected) %>   </select> </p>

<p>   <label for="report_new_category">Other:</label>   <%= text_field 'report', 'category_id' %> </p>

Thanks in advance, Glen

Nevermind, I should have poked it with the "stick" a few more times before I posted.

Using <%= text_field_tag 'new_thing' %> rather than <%= text_field 'report', 'thing' %> gave me the values in params I was looking for.