I want to display a list of articles in my tag's show view. I'm using the acts as taggable redux plugin in a Rails 2.3.2 and SQLite3 app. I've got as far as the basic example takes me, assigning tags and then displaying a list of them with the article.
Now I want to display a list of articles belonging to a tag but get the following error:
undefined method `article' for #<Tag id: 1, name: "various", taggings_count: 1>
Models
/article.rb
class Article < ActiveRecord::Base
acts_as_taggable
end
/user.rb
class Tag < ActiveRecord::Base
acts_as_tagger
end
Controller
/tags_contoller.rb
def show
@tag = Tag.find(params[:id])
@articles = @tag.articles
end
View
/tags/show.html.erb
<% for article in @articles %>
...
<% end %>
Here is a link to the migration file.
Thanks very much.