Package as gem
I'm not sure if you are open to PRs but I've packaged this as a gem. I haven't published it yet because I would like someone to review it as I haven't packaged a gem before.
It also seems like the has_and_belongs_to_many relation merging is broken. I could have broken it with my updates and refactorings or by using it with updated dependencies but I didn't touch the merge module other than making style changes rubocop suggested. It seems to be looking for foreign keys directly on the other objects and not on the merge table. This is causing 2 of the tests (relating to the has_and_belongs_to_many relation) to fail.
I added a condition that prints a warning that the current version doesn't support has_and_belongs_to_many relations. If someone wants to figure out what is wrong or fix it, that should be removed before testing.