How would I write a named_scope that checks if the parent has at least
one associated child?

For example,
class Post < ActiveRecord::Base
  has many :comments

  named_scope :commented_on, :conditions => "comments.count > 0"


class Comment < ActiveRecord::Base
  belongs_to :post



Thanks,
            jeff

--

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