Topic: Search by alphabetical letter

So at the top of my page I have the alphabet and what I want to do is when you click on a specific letter e.g. D then I want it to return all records that have the same first letter.How would I go about doing this? I have done some code but it does not work it just shows the full database table every time. I have the following code so far.index.html.erb :<% for char in 'A'..'Z' %><%= link_to(