Forum: Ruby on Rails Hacking journey::routes and simple-navigation

Posted by Adam Wong (Guest)
on 2013-01-09 22:21
(Received via mailing list)
I really love the simple-navigation gem but there are some problems. My
configuration file is structurally identical to my routes file. That
redundancy is bad enough  *but* if I navigate to a url that
simple-navigation can't catch, it fails completely.

So I'm attempting to auto-generate my navigation directly from my 
routes,
so that there's a navigation item for every possible route and "going 
off
the map" is impossible.

An example:
resources :widgets should create a nav_item corresponding to the url
"widgets." This nav_item should have some children nav_items 
corresponding
to the show and edit widgets urls.

I've had good progress but simple-navigation stores nav_items in what is
essentially a tree structure while routes are stored as a list. I want 
to
maintain the structure of my routes.rb, so this poses a bit of a 
problem. I
tried to find the children of a route by regex'ing the all the url's but
this won't guarantee that I maintain the structure of my routes.rb file.

So my question is this: How do I extend Journey::Routes so that the
"widgets/" route maintains a parent-child relationship with it's 
"derived"
routes?

My work so 
far<https://github.com/adamwong246/StEnki/blob/master/...
my 
routes.rb<https://github.com/adamwong246/StEnki/blob/master/...
A half-working attempt. Might be slow to load, I can't afford anything
better. 
<http://ifailedtheturingtest.herokuapp.com/pages/fi...
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.