title: Ruby on Rails - passing params into 301 redirect in routes.rb
body: <p>I want to change my existing 'game' routing inside routes.rb, but because of SEO I need also to setup 301 redirect for old links.</p>
  
  <p>My old routing:</p>
  
  <pre><code>match 'games/:permalink/:id/(:page)' =&gt; 'games#show'
  </code></pre>
  
  <p>New routing:</p>
  
  <pre><code>match 'gierki/:permalink/(:page)' =&gt; 'games#show'
  </code></pre>
  
  <p>Here is redirection which I tried to to do:</p>
  
  <pre><code>match 'games/:permalink/:id/(:page)' =&gt; redirect {|params| "/gierki/#{params[:permalink]}" + params[:page].nil? ? "" : "/#{params[:page]}" }
  </code></pre>
  
  <p>Above redirect is not working, here is an error:</p>
  
  <pre><code>wrong number of arguments (1 for 2)
  </code></pre>