Finne Jager wrote in post #968131:
>>> 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 GET   /incidents/:incident_id/timesheet(.:format)
>    {:action=>"show", :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'

Of course.  You forgot the _path.

Please go read the routing docs again, paying particular attention to 
the autogenerated helpers.

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

Sent from my iPhone

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