Для этого вы должны использовать has_many :through
связь.
class Comment < ActiveRecord::Base
belongs_to :user
end
class User < ActiveRecord::Base
belongs_to :company
has_many :comments
end
class Company < ActiveRecord::Base
has_many :users
has_many :comments, :through => :users
end
Теперь вы можете сделать следующее:
c = Company.first
c.users # returns users
c.comments # returns all the comments made by all the users in the company