Hello,
I have two tables:
class Person < ActiveRecord::Base
has_and_belongs_to_many :projects
end
class Project < ActiveRecord::Base
has_and_belongs_to_many :people
end
Then I want to get people working on a project. I do:
project_record.people.find_all_by_foobar( foobar )
It works, but it internally loads ALL the people working on the project,
not
only “foobar” people.
It seems that just using “project_record.people” loads everything into
memory.
Is there any workaround how to load only what is really needed? Lets
imagine
there is huge amount of projects and you just want to check if a person
works
on a certain project…
Thank you,
Jan