-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
I have this model:
class Comment
include Mongoid::Document
include Mongoid::Timestamps
field :name
field :text
field :published, :type => Boolean, :default => false
embedded_in :commentable, :inverse_of => :comments
validates_presence_of :name, :text
scope :pending, where(:published => false)
scope :published, where(:published => true)
end
So when I do this:
commentable.comments.published.count # => 3
commentable.comments.pending.count # => 3
commentable.comments.published.size # => 1
commentable.comments.pending.size # => 2
count doesn't filter, and returns the total of comments.
To filter I have to use size() instead of count().
Is this the expected behaviour?