sl_bug wrote in post #977638:
> I want to know files count for some user. is there some 'right' way to
> do it without getting all tasks and looping it?
>
> P.S. there is really many tasks and files.

ActiveRecord includes aggregate calculations for this purpose that 
perform the counts, sums, averages, etc. at the SQL layer:

http://railsapi.com/doc/rails-v3.0.3/classes/ActiveRecord/Calculations.html

-- 
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 [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