Translate SQL statement into named_scope?

Posted by keruilin on Stack Overflow See other posts from Stack Overflow or by keruilin
Published on 2010-05-08T21:04:17Z Indexed on 2010/05/08 21:08 UTC
Read the original article Hit count: 215

Filed under:
|
|
|

How can I translate this SQL into a named_scope? Also, I want the total comments param to be passed through a lambda.

"select users., count() as total_comments from users, comments where (users.id = comments.user_id) and (comments.public_comment = 1) and (comments.aasm_state = 'posted') and (comments.forum_user_id is null) group by users.id having total_comments > 25"

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about named-scope