Displaying 2 results from an estimated 2 matches for "favorites_count".
Did you mean:
favorite_count
2006 Apr 30
2
HABTM: Find sorted by number of associations
Hi,
I''ve been googling and searching the forums for some time
but can''t seem to find exactly what I''m looking for.
Suppose User HABTM Products (for example a favorites list). I would like to
construct a single query for finding Products ordered by the number of
Users that have flagged them as favorites.
Although I can construct the query using SQL a with a
2010 Oct 04
4
http caching a dynamic page
...ral best practice to deal with something like this..
##Post controller
def show
@post = get_from_memcache
end
##show.html.erb
<div><%= post.body%></div>
<div><%= post.created_at%></div>
<div><%= post.category%></div>
<div><%= Post.favorites_count%></div>
The get_from_memcache return a @post object from a cache that
basically doesn''t expire, because once a post is created, it''s body,
category, created at etc remains the same.
However, in my view I do call another method favorites_count which
collects the posts...