I have a Rails blog coming along quite nicely. However, I cannot seem to get my tagged articles to show up within their own page (for example, I’d like ONLY the articles tagged Arts & Entertainment to show up when that link is clicked).
I have a column in my scaffold model entitled tags. It takes a string. So
1) How do I go about accessing ONLY a specific tag? I tried something like the following:
def self.sports
find(:all, :tags => 'gainmuscle')
end
to no avail.
2) How do I get them to show up in the view?
Any help would be very much appreciated.
You can probably define a method inside your controller something similar to this :
Here
taggedis anamedscope. you can neglect that but the action generates all the articles which are tagged with the tag selected as:param. Tag is an attribute of the model Article in this case.