Is there any offical way you could dynamically dispatch controllers in
Rails 3?
My goal is to invoke different controllers based on path segments like
this:
/news/sport-blog, should map to a blog controller
or
/news/sports/2, should map to a page controler
In the example cases above, the path should be queried from a STI page
model, and the type attribute should decide which controller to
invoke.
psuedo code:
match "*path_segments", :to =>
"#{Page.find_by_path(params[:path_segments]).type}#index"
The idea behind this is that it fits very nice in a cms system where
informative url:s are important. I''ve looked at other cms systems
built on Rails, many uses a single catch-all controller, but that
forces you to write another dispatcher on your own.
Thanks in advance
Fredrik Martenson
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.