This a solution for a problem that I recently faced.
Let's say we have these three classes Store, PaymentMethod and StorePaymentMethodSetting. A store may have multiple payment methods and these payment methods are similar between the stores. So here we have a HABTM (has and belongs to many) relationship between the Store and the Payment Method. I didn't use HABTM relationship, instead, I used has_many :through relationship, that's because I needed to use the relationship model (StorePaymentMethodSetting) as an independent entity to set the availability of a payment method in a store. Although I would always recommend using has_many :through instead of has_and_belongs_to_many, you never know if in the future you'll need the relationship model to have some attributes.
So here comes the problem, I wanted to update the availability of a payment method through the payment method itself. I mean, I didn't wanted to have