I am trying to get a has_many :through
relationship working in Ecto for a many-many relationship between a User
model and Group
model.
The only information I was able to find online was related to nested attributes in a post by José Valim here (which is excellent, by the way).
Since the groups already exist in the system, I was hoping to do a multiple select input. I ran into a couple issues in doing that. I don't believe that it is possible to assign the groups
association in the changeset directly because I was getting an error every time I attempted to do so. My next thought was to do the work manually (finding, deleting, and inserting GroupMembership
records), however I wasn't sure if this was the right path to go down, and wanted to get some advice first.
Since the code sample has quite a few lines I made a gist here.
If it's preferred that I post it in this question directly, I can certainly do that.
Thanks for all the help!