Skip to content

has_and_belongs_to_many #26

Description

@chumakoff

Whenever I update a main record, versions for hundreds associated through 'has_and_belongs_to_many' records are created.
Is that an expected behavior?

class AnyModel < ApplicationRecord
  has_and_belongs_to_many :any_associations
end

record = AnyModel.last
record.any_associations.count # => 999999999999
record.touch  # this will result in 99999999999 "INSERT INTO `version_associations" SQL queries

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions