How do I get a counter for an "each" loop in Rails?
Take a look at Enumerable#each_with_index
http://apidock.com/ruby/Enumerable/each_with_index
Use each_with_index
: the index will automatically be your counter (but note it starts at 0 and not 1):
<% @album.each_with_index do |e, index| %>
<%= link_to e.name, :controller => "images", :action => "album", :album_id => e.id, :album_name => e.name %>
<% end %>