Auto eager loading broken for has_and_belongs_to_many associations that use the uniq option
Closed this issue · 0 comments
jturkel commented
Consider the following models:
class Post < ActiveRecord::Base
has_and_belongs_to_many :authors, uniq: true
end
class Author < ActiveRecord::Base
has_and_belongs_to_many :posts, uniq: true
end
The uniq
option is ignored by Rails when eager loading Post#authors
.
Note this is only a problem in Rails 3 since the uniq
option was removed in Rails 4 (in favor of using a lambda to customize the association scope).