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/1returning my page Show, I want the page to be accessible along the route albums/lets-talk.
So, in my controller, I:
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 succeeds in its function, however the Ruby API says my link_to method is old and archaic with no alternatives, so I suspect I'm wrong.
source
share