Hello, I have a Post that has_many Comments. I have the next scopes:

scope :valid, where('created_at >= ?', 2.months.ago)
scope :expired, where('created_at < ?', 2.months.ago)

Now, I would have a scope named :commented that return all the Post
that have more than 0 Comments but I don't know how do it clearly. A
solution is have a counter num_comments column in Post, but I don't
know if that is the best practice.

Thanks for your advices. Bye.

Daniel

-- 
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