Topic: Avoid smelly code
In my project I have different types of reviews, e.g. cd reviews, concert reviews and so on. Now when creating these reviews I use a collection_select in the views to get an artist dropdown. My problem is: There are many ways to grab the artists:
<%= collection_select :band_review, :artist_id, Artist.find(:all), :id, :name %>
this looks pretty ugly to me...
<%= collection_select :band_review, :artist_id, @artists, :id, :name %>
and in the controller:
@artists = Artist.find(:all)
I guess this is ok but since I have several types of reviews I will have to put this code into every controller.
Last idea: Use the application_helper.rb so I can use this method in every view:
Well, simple code, but what