Hello All,
I have a model “Company”
class Company < ActiveRecord::Base
has_and_belongs_to_many :types
end
And I also have MachineType and CompanyType that STI from the “Type”
model.
I have both a MachineType id and a CompanyType id and I want to get
all companies that have both of those types.
Is there a way similar to something like this:
@companies =
MachineType.find(params[:type]).companies.types.find(@type) ?
I’m just trying to figure out how to do this type of thing without
some nasty joins.
Thanks!
BJ Clark
the science department.