Displaying 1 result from an estimated 1 matches for "find_popular_articles".
2006 Mar 22
2
habtm vs. has_many/belongs_to
...orate it with a richer set of behavior. This lets you
accompany the
data with methods.
As an example, we could turn the articles_users relationship into a new
model called Reading. This Reading model will belong_to both an article
and a user. And it?s now the obvious spot to place methods such as
find_popular_articles( ), which can perform a group by quer y and
return the
articles that have been read the most. This lightens the burden on
the Arti-
cle model and turns the concept of popularity into a separated concern
that naturally sits with the Reading model. "
First, I assume this means that the othe...