Hi. I have few models - user, task, file

class User < ActiveRecord::Base
  has_many :tasks
end

class Task < ActiveRecord::Base
  belongs_to :user
  has_and_belongs_to_many :files
end

class File < ActiveRecord::Base
  has_and_belongs_to_many :tasks
end


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.

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