Let's say I have a relatively basic CRUD application for editing music albums. In the database I have:
id | album_name | artist | navigation
1 Lets Talk Lagwagon lets-talk
However, instead of albums/1
returning my Show
page, I want the page to be accessible by the albums/lets-talk
route.
So in my controller I have:
def show
@album = Album.find_by_navigation(params[:id])
end
And in my index view I have:
<%= link_to 'Show', :controller => "albums", :action => "show", :id => album.navigation %>
This successfully performs its function, however, the Ruby API says my link_to method is old and archaic without listing an alternative, so I suspect I'm going about this the wrong way.