Hey, folks.

I have articles, which have and belong to many tags. For a given
article, I need to produce a list of tags and associated articles, but
make sure that an associated article doesn't appear under more than
one tag. Also need to limit the list to 3 articles for each tag, and
make sure the given article doesn't appear in the list.

I've started it like so, but it's ugly and still contains duplicate
articles, and I'm drifting into array/hash insanity.

  for tag in article.tags
    puts tag.name
    for relatedArticle in tag.articles
      puts relatedArticle.title
    end
  end

Any suggestions appreciated!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to