title: How can I use a dynamic attribute for route generation in rails?
body: <p>In my model I have this custom method:</p>
  
  <pre><code>def encoded_id
      "foo#{self.id.to_s}"
  end
  </code></pre>
  
  <p>Now, upon calling <code>mymodel_path(myobject)</code> I would like the method mymodel_path to receive encoded_id as part of the attributes (eg. <code>{id: 123, bar: 'bar', encoded_id: 'foo123'}</code>).</p>
  
  <p><strong>How can this be achieved <em>without</em> having to specify it on the method call itself?</strong></p>