Closed wdiechmann closed 7 years ago
can you please post the results you get back?
Also, what does Repo.all "jobbers_jobs" returns? Do you have duplicate entries by any chance? --
José Valim www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D
dammit - José - my bad!
Battled this for nearly 8 days! Verified jobbers, jobbers_jobs - and jobs - every time it matched - when I used DISTINCT
This is no help - if you already has TWO records in the table (which I did have - for one lousy record almost at the bottom of the table of 262 posts - at which time you start to decide that everything is OK!!)
def build_job([head|tail],current_jobs) do
changeset = Job.changeset(%Job{},head)
case Map.fetch(current_jobs,head.jobs_id) do
{:ok, job} -> Job.changeset(job, head) |> Repo.update
:error -> Repo.insert(changeset)
end
build_job(tail,current_jobs)
end
apologies Walther
Environment
Current behavior
In this thread https://elixirforum.com/t/many-to-many-associations-in-phoenix-and-ecto/1043/10 I detail the schemas ('jobbers', 'jobs', and the many_to_many relationship 'jobbers_jobs')
Whether I say
or I say
each job is blessed with TWO sets of jobbers 😦
Using string primary keys may be the culprit (guestimate) as a broad range of many_to_many tests are readily at hand I should say.
The SQL produced (referring to the first statement above) is:
Expected behavior
or (at least feasible on the single row query) bypass the product (j0 x j1) alltogether with