Hello, i have the following models in my application:

class Message < ActiveRecord::Base
  has_many :comments, :as => :commentable, :dependent => :destroy,
:order => 'created_at ASC'
end

class Comment < ActiveRecord::Base
  belongs_to :commentable, :polymorphic => true
end

I need "commented" named scope, which do the follownig thing:

Message.commented -> returns all messages where comments is > 0.

How i can do this?
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to