Topic: working with related models

Hello everyone, I am new to Ruby and to this form. Please correct me if I am posting in the wrong category. Here is my issue.

I currently have two models Company and Facility and they are related in that a Company can have many facilities.

It is set up now that an admin can go to the application and add tombstone information to a Company (60+ fields). What I need to do is allow the admin to add facilities to each company put in and I am not sure on how to approach this. Here are my two ideas:

1 Some how when the question comes up enter facilities which is roughly in the middle of the company new submission form. To leave the new Company form and save that data captured so far and then add Facilities. When finished completing the Facilities section, to jump back into the company profile and continue where it was left off (which would now be an update to the company).

2 Admin full completes adding the company tombstone information and then goes to show where they can click a link that will allow them to add facilities to that company.

I started to do number 2 but being such a rookie (1 week in), I am unsure on how to pass the company id to the new facility form and access it there.

I really hope someone can help

Thanks in advance

Re: working with related models

How about in your views/companies/show.html.erb:

<%= link_to "Add Facility", { :controller => :facilities, :action => :new, :company_id => } %>

And in controllers/facilities_controller.rb:
def new
  @facility =
  @company = Company.find(params[:company_id])

But I can't remember off the top of my head what you'd need to do in views/facilities/new.html.erb to the form tag.  Maybe something like this?
<% form_for(@facility, :url => { :action => :create, :company_id => }) do |form| %>
<% end %>