I do this in Inkling. The step I've taken which others haven't in their 
replies is to use a routing constraint - 
see https://github.com/tfw/inkling/blob/master/lib/inkling/routing.rb .

Then my routes look something like: 

  inkling_match(:archive_studies)
  inkling_match(:archive_catalogs)
  inkling_match(:pages)

Essentially, these routes say - build a route to a model called Page. 
Interrogate each request to see if a Page can match the current request. If 
it can, look up the id of the Page and place it in params and pass the 
request to the PagesController#show method. 

Building a link to the object is simple - link_to foo.title, foo.urn (where 
urn is a method that maps to the path which the routing constraint 
understands). Then, of course, your model uses the to_param solution for the 
clean URL.

I do this for CMSy apps (well, I call it knowledge management, as the 
content is usually more than a simple page). And the approach I've taken 
reflects that (all you have to  do is write acts_as_inkling on a model and 
it gets this behaviour). But you could probably use routing constraints for 
what you want - 
see http://guides.rubyonrails.org/routing.html#advanced-constraints

You were almost there when you reached the routing layer. You don't 
necessarily have to write the catch-all.

Hope this answered your question.

Cheers,
Nicholas

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rails-oceania/-/F2G8nFJUVJEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to