andi/simple-navigation — Issue #85: Problem with deeply nested navigation
Author: mwean
Created: 2012-02-03 01:52:01+00:00
State: open

I'm trying to set up navigation with 3 levels of resources (6 total menus), but it seems to break after the second resource.

Here are my routes:

```ruby
resources :people, shallow: true do
resources :children, shallow: true do
resources :pets
end
end
```

and here is my navigation file:

```ruby
SimpleNavigation::Configuration.run do |navigation|
navigation.items do |primary|
primary.item :people, 'People', [:people] do |people|
if @person
p 'PERSON'
people.item :person, 'Person', [@person] do |person|
unless @person.new_record?
person.item :children, 'Children', [@person, :children] do |children|
if @child
p 'CHILD'
children.item(:child, 'Child', (params[:action] == 'show' ? [@child] : [@person, @child])) do |child|
unless @child.new_record?
child.item :pets, 'Pets', [@child, :pets] do |pets|
p 'PETS'
if @pet
p 'PET'
pets.item :pet, 'Pet', params[:action] == 'show' ? [@pet] : [@child, @pet]

end; end; end; end; end; end; end; end; end; end; end; end
```

I can navigate down to showing a child, and I get the following navigation:

People > Person > Children > Child > Pets

In the log, I see 'PERSON', 'CHILD', 'PETS'.

However, when I go to the Pets page for a child, my navigation goes back to only People, and nothing shows up in the log. It seems like it's hitting an error somewhere and then the whole navigation file is failing, but I can't find where that might be. I'm having this problem in a big project, so I made this test app with the same results, so I'm at a loss. I've even tried ```:highlights_on => lambda { true }``` on some or all of the levels with no result. I'd appreciate any help anyone can provide.