Hello,

I have two many-to-many relationships modeled like so:

  - a Company has many Users
  - a User has many Bugs

The Company model has:

  has_many :users

The User model has:

  belongs_to :company
  has_many :bugs

The Bug model has:

  belongs_to :user

Should I be able to say:

  <%= @company.users.bugs.count %>

(Currently, I'm getting the error "undefined method 'bugs' for ..."
trying to do this.)

Or do I have to tack a 'company_id' onto each bug and say
@company.bugs.count?

Thanks,

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