How to use has_many :through association?

Let’s say I have

group
has_many :memberships
has_many :members, :through => memberships

and vice versa, and there’s a model called memberships that stores extra
information, such as the reason for joining, etc.

How do I then actually USE this in my models, controllers and views?

Do I need to create new memberships using a form?

Can I for instance, on a group’s show view that displays an individual
group, have a form at the bottom that allows the CURRENT USER to JOIN
the group and provide a reason for joining by sending a put request form
to the memberships controller?
How would I access the memberships form if I’m on the group’s page?

Thank you for your help and patience.

I can’t get what you exactly need but I am prefered to refer this link