On Dec 13, 2010, at 3:08 PM, Finne Jager wrote:

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>
----------------------------

Right, of course.  Run rake routes to see what your routes look like
now.

Ok, I ran 'rake routes' and it showed:
--------------------------------
incident_timesheet POST   /incidents/:incident_id/timesheet(.:format)
{ :action=>"create", :controller=>"timesheets"}
----------------------------------

So I changed the code in my Index view to:
---------------------------------
<td><%= link_to 'View Time Sheet', incident_timesheet %></td>
---------------------------------

That triggers: undefined local variable or method `incident_timesheet'

--

OK, you're really close. However, think about that route. It needs an :incident_id and you haven't given one. For the create, you'll want to do incident_timesheet_path(incident)

-Rob

Rob Biedenharn          
r...@agileconsultingllc.com     http://AgileConsultingLLC.com/
r...@gaslightsoftware.com               http://GaslightSoftware.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