You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to follow the documentation to create a composite key for a relation.
The current setup is primary_key :job_id, :user_id
However, calling the primary_key only yields the job_id and does not return both values. I believe this is preventing me from updating and deleting by_pk
Two current workaround we used was to add an extra customized view :by_cpk which will handle the two primary keys or by declaring a new method in the specific relation with the composite key to handle the primary keys that we need it to.
1st)
view(:by_cpk, attributes[:base]) do |pk1, pk2|
where(:job_opening_id => pk1, :user_id => pk2)
end
2nd)
def by_cpk(user_id, job_opening_id)
where(user_id: user_id, job_opening_id: job_opening_id)
end
The text was updated successfully, but these errors were encountered:
I was trying to follow the documentation to create a composite key for a relation.
The current setup is primary_key :job_id, :user_id
However, calling the primary_key only yields the job_id and does not return both values. I believe this is preventing me from updating and deleting by_pk
Two current workaround we used was to add an extra customized view
:by_cpk
which will handle the two primary keys or by declaring a new method in the specific relation with the composite key to handle the primary keys that we need it to.1st)
2nd)
The text was updated successfully, but these errors were encountered: