I have a User model and a Thing model. I want to link users with
things, so I have a migration that creates a permissions table with
user_id and thing_id. The migration works fine and gives me three
columns, I assume I need the permission’s ID so that I can delete it in
Three questions come to mind though, which I have given thought but got
Does the permissions table need the ID column?
Is there any way in the backend/SQL (or otherwise) to ensure that a
given pair of user_id and thing_id are unique? Obviously the columns
cannot themselves be unique, because a user may have more than one
What is the easiest way to make a UI to link users with things?
Currently I just have two controllers that are slightly modified from
the scaffold. Is there a neat way that’s friendly and quick for the
end-user to assign users to things that is also fairly easy to code?
I’ve looked for some examples in existing projects but haven’t found