Hacking journey::routes and simple-navigation

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
farhttps://github.com/adamwong246/StEnki/blob/master/lib/core_extensions/route.rb
my
routes.rbhttps://github.com/adamwong246/StEnki/blob/master/config/routes.rb
A half-working attempt. Might be slow to load, I can’t afford anything
better.
http://ifailedtheturingtest.herokuapp.com/pages/files/nav.html.slim

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs