Hotfix for anonymous class
Hotfix for anonymous class

I managed to reproduce this bug with has_and_belongs_to_many association

class Entity
  has_and_belongs_to_many :followers, ->{ distinct },
    class_name: "Entity",
    join_table: "entities_following_entities",
    foreign_key: "follower_id",
    association_foreign_key: "target_id"
end

To cause a bug run:

  entity.follower_ids=[1]

(cherry picked from commit 604520fdf7b766c1092a6c3922cc6da021e5d4a4)

chilloutio/chillout,chilloutio/chillout