I created a custom route that looks like this:
Hierarchically, :table is above :action and :id. So, if we call
ActionController::Base#url_for with an argument :table=>nil, we’re
supposed to get a url with :action and :id set to nil as well.
However, this is not the case:
url_for(:table=>nil) from /manager/tables/currency/add/1
returns “/manager/tables/add/1”. In effect, both :action and :id are
treated as if they’re above :table in the hierarchy chain!
I ran a few tests, such as setting the route to
‘:controller/:table/:action/:id/:blah’. And indeed, :table=>nil reset
the lower (right) parts of the route hierarchy except for :action and
:id. Those seem to always be treated as if they’re above any custom
component I added myself, regardless of how high (left) I placed them
in the route hierarchy.
My questions are:
Is this a bug or a feature?
Is there support for adding custom components to the route that are
higher than :action and :id?