Take advantage of the named_scope method in your models and make find queries simple and beautiful!
#app/models/comment.rb class Comment < ActiveRecord::Base belongs_to :post named_scope :pending, :conditions => ["pending = ?", true] named_scope :for, lambda { |*args| {:include => :post, :conditions => ["posts.account_id = ?", (args.first||0)] }} endNow you can get all comments for your posts that are marked as pending with this method:app/models/post.rb
class Post < ActiveRecord::Base has_many :comments end
@comments = Comment.pending.for(@account.id)
Just finishing up brewing up some fresh ground comments...