Mixing dynamic and static content in routing


#1

Hi all,

I am working on a small project–a backend for a website with a tree
like structure. I have a Node model which acts_as_tree and use
polymorphic associations to “link” differend resources (a free form
page, a course description and so on) to the nodes.

In my routes.conf I have

map.connect ‘/homepage/*path_info’, :controller => “index”, :action
=> “show_node”

and path_to_chain(path) and chain_to_path(ary) methods in the node
class for generating a hierarchy of nodes from a path and a path from
a hierarchy of nodes respectively.

The node hierarchy is completely configurable by the user (adding and
removing nodes, turning node visibility on and off, reordering).

This covers most of what I want to achieve.

I will however also want to iclude in the hierarchy a few custom
controllers (a gallery, a small posting system, some staitstics). I
could “hardwire” routes to these controllers but this would make them
static in the hierarchy and I want them configurable.

So I am looking for a way to associate not only an ActiveRecord to a
node but also a whole “controller”. Now, I know this is not possible,
so any general ideas towards a solution will be greatly appreciated.

I hope I have made myself clear enough and apologise for the long post.

Many thanks in advance,
Nickolay