Hi, I am very new ruby on rails and I need to do what is I think is
quite a complex find and I wanted to get some opinions on how to do it
in a way that doesn’t hog resources.
My tables look like this :
CREATE TABLE “candidates” (“id” INTEGER PRIMARY KEY AUTOINCREMENT NOT
NULL, “first_name” varchar(255), “last_name” varchar(255),
“created_at” datetime, “updated_at” datetime);
CREATE TABLE “codes” (“id” INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
“name” varchar(255), “value” varchar(255), “created_at” datetime,
“updated_at” datetime);
CREATE TABLE “candidates_codes” (“code_id” integer, “candidate_id”
integer);
candidates_codes is my intersecting table between a habtm
relationship
I have two groups of codes locations and languages and the code values
are things like French, London, NY
I need to be able to search for candidates based on what language
skills they have and in what location they are in.
The bit I really am struggling on is its needs to be able to work in
two ways ether the candidate speaks German and lives in London and the
second way is the candidate speaks German or lives in London.
I have been playing with find but I can only seem to start getting it
to work by having loads of finds which is going to make the search
slower as the number of candidates increases!
Thanks, Alex