(Warning: Clueless Rails Newbie!)
In my show.html.erb for my albums view, I call a public method in my albums controller:
<% albums_feature = find_albums_with_feature(feature.id) %>
It generates a NoMethodError.
So I copied the method into my Album model and tried calling it from the view as:
<% albums_feature = Album.find_albums_with_feature(feature.id) %>
But this also gets a NoMethodError.
Where should I define this method?
For what it's worth, the method looks like this:
def find_albums_with_feature(feature_id)
albums_for_feature = Albums.find_by_sql(
["select al.* from albums al, albums_features alfe
where al.id = alfe.album_id
and alfe.feature_id = ?", feature_id])
end