Thank you, I appreciate your help so far, I feel like we're getting
there!

> And Timesheet belongs_to :incident , I hope?

Correct.

> See the routing documentation.  Once you *do* nest them, you get the
> routes you need for free.
>
> If you don't want to nest them, other solutions are possible, but I'd
> advise nesting if it's feasible for your project.

Ok, I have nested them like this:
----------------------------
resources :incidents do
 resources :timesheets
end
----------------------------

And I changed Incidents#create to this:
----------------------------
if @incident.save
 format.html { redirect_to incident_timesheet_url(@incident) }
----------------------------

Is that the 'free route' you mentioned?

On a side note, by changing the resources to nested instead of top
level, it broke my Index page which shows a list of Incidents and their
Timesheets. It pointed out this line of code:

----------------------------
<td><%= link_to 'View Time Sheet', timesheet_path(incident) %></td>
----------------------------

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to