Rails 3: how to code a route path <p>I'm creating a rails app and I can't figure out or find answer for this problem.</p> <p>What is the route for:</p> <p><code>@example = Example.find_by_notId(params[:notId])</code></p> <p>I want my route to look better then /example/1 and would rather have it read /notId (where notId would be title or some other non-ID int). Normally I would use show_path but in my html <code>&lt;%= link_to image_tag(pic), show_path(example) %&gt;</code> doesn't work. Here is my code and it works when I hard code it into the URL (localhost:3000/notId) but I need a way to route it through a link. Any ideas?</p> <p>Show </p> <pre><code>def show @example = Example.find_by_title(params[:title]) end </code></pre> <p>Routes</p> <pre><code>match '/:notId', to: 'example#show', via: 'get' </code></pre> <p>_example.html.erb</p> <pre><code>&lt;div class="example"&gt; &lt;% Movie.all.each do |example| %&gt; &lt;%pic = example.title + ".jpg"%&gt; &lt;%= link_to image_tag(pic), show_path(example) %&gt; &lt;% end %&gt; e&lt;/div&gt; </code></pre>