Hello, i have the following models in my application:
class Message < ActiveRecord::Base
has_many :comments, :as => :commentable, :dependent => :destroy,
:order => ‘created_at ASC’
class Comment < ActiveRecord::Base
belongs_to :commentable, :polymorphic => true
I need “commented” named scope, which do the follownig thing:
Message.commented -> returns all messages where comments is > 0.
How i can do this?