Search code examples
ruby-on-railspaper-trail-gem

versioning on a has_and_belongs_to_many?


Is it possible at all to have versioning for has_and_belongs_to_many associations? The official documentation only briefly mentions has_many and belongs_to. I have added papertrail on both ends of my has_and_belongs_to_many association, run the migrations and whenever I update the association from either end, nothing ever gets added to the version_associations table. Could someone point me in the right direction?


Solution

  • Is it possible at all to have versioning for has_and_belongs_to_many associations?

    Yes. HABTM reification was added very recently (2016-04-25) in PR 771 and released in version 5.0.0.

    The official documentation [does not mention HABTM] ..

    That's correct. We'd appreciate contributions to that documentation, thanks!

    PS: Please note that associations are an experimental feature, not recommended for production systems.