Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

.page() introduces duplicates in HABTM :uniq relationship #255

Open
johngtimms opened this Issue · 1 comment

2 participants

@johngtimms

blog_posts.rb
has_and_belongs_to_many :tags, :uniq => true

tag.rb
has_and_belongs_to_many :blog_posts, :uniq => true

Per the documentation for ActiveRecord, :uniq does not prevent duplicate relationships being stored, it just ignores them when building the query.

Here is the issue:
tag = Tag.find(1)
tag.blog_posts.count equals 1, but:
tag.blog_posts.page(nil).count equals 3, and all 3 are duplicates of the same post. The correct behavior should be to show only 1, not duplicated.

@anthonyalberto

See #251

It's a problem with Rails

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.