title: Recursively redirecting in Rails 3 Routes
body: <p>We are updating our large web app and getting rid of our URL synonym system. For example, though we only use one model for 'advertiser', it is aliased to 'merchants' and 'sellers', using synonymous paths. Thus, /merchant/1 and /seller/1 use the same exact controller and action as advertiser/1.</p>
  
  <p>We no longer need this functionality, but we do need for old URLs to correctly redirect users to the proper place (i.e. proper controller actions).</p>
  
  <p>So far, I've tried:</p>
  
  <p>1) reading <a href="http://guides.rubyonrails.org/routing.html" rel="nofollow">http://guides.rubyonrails.org/routing.html</a> - This lead me to try the following suggestions</p>
  
  <p>2) match '/merchants' => redirect('/advertisers') - this didn't seem to work at all, though the syntax seems correct.</p>
  
  <p>3) iterating over resources (this produces a TON of routes and may cause insecurities):</p>
  
  <pre><code>ADVERTISER_SYNONOYMS = ['affiliates', 'sellers']
  
  ADVERTISER_SYNONYMS.each do |a|
    resources :advertisers, :path =&gt; a,  :as =&gt; :advertiser
      resources :other_controller do
        member do
          get :test
          match :generate_test
        end
      end
    end
  end
  </code></pre>
  
  <p>We use nested resources in our routes.rb, so I'm struggling with getting these synonymns to be recognized all throughout more complex URLs. If anyone dealt with this problem or has a more elegant suggestion, I'd be most grateful.</p>