In Ruby on Rails I have the following model relationship: A has_many :c, through: :foobar, source: :foobarable, source_type: “C”. When I want to create (or remove) an association (foobar) between A and C, what is the idiomatic Rails way of doing this through the UI? For example from an A view, add (or remove) a C (or vice-versa).
Should I have an independent controller for the association model (foobar) with create and destroy actions that are called to add or remove an association?
The idiomatic way would be to have create and destroy actions on the association controller.
In terms of the views, that is a lot more wide open and depends on your app and the specifics of its UI. You can add buttons or links to the views for A and/or C, and/or something else entirely that hits the association create/destroy action.