I have this list that should show all activities inside a category, and it sort of works but the last element that is displayed is strange. There are 4 activities in the DB for this particular category and at the end of the list I'm getting an item /categories/1/activities
%table.catlist
- @category.activities.each do |activity|
%tr{:class => cycle('one','two')}
%td= link_to activity.name, [@category, activity]
%td
I also tried:
link_to activity.name, category_activity_path(:category_id => @category.id, :id => activity.id)
But that's not working at all, and giving me this error:
No route matches {:category_id=>1, :action=>"show", :controller=>"activities", :id=>nil}
The routes are nested like this:
resources :categories do
resources :activities do
resources :records
end
end
It's actually showing everything right, but it closes the list with this strange element which is basically the activity path, but without an id.
EDIT
I think this is happening because of the cycle
method that is supposed to switch between CSS classes. Any ideas how the empty row can be avoided?