I have a site that consists of a blend of static and dynamic pages. The
solution I came up with uses the default routing to try to pair up a
controller and action for the dynamic stuff and, if the url doesn’t
jive, rails attempts to render the static content with a special
controller just for rendering that.
To allow the static content to use all sorts of user memorable URLs I
map.connect ‘*misc_url’, :controller => ‘static’, :action =>
Seems graceful enough (though I have to handle 404 page rendering in the
static controller since it gets EVERYTHING).
So assuming I have a controller named “a” with an action named “b” and I
try the URL “/a/b” => all is well.
Then I try “/something/else” => the static controller gets it and deals
with it appropriately.
But then I try “/a/bogus_action” => I get “Unknown Action” Apparently
routing does not ever hand this one off to the Static Controller (where
404 or other appropriate responses reside).
Is this a bug? Is rails really supposed to leave it up to the
controller that doesn’t have a corresponding action? If this is “good”
behavior, is there some kind of workaround that I can mixin to all my
controllers or to routing to so that this ends up being handed to the