This project is archived and is in readonly mode.

#2447 ✓resolved
DerGuteMoritz

:uniq option doesn't work with has_many :through and eager loading

Reported by DerGuteMoritz | April 7th, 2009 @ 08:41 PM | in 3.x



class LineItem
  belongs_to :event
end  

class Order
  has_many :line_items
  has_many :events, :through => :line_items, :uniq => true
end

Order.first(:joins => :line_items).events # => expected result
Order.first(:joins => :line_items).event_ids # => contains duplicate IDs
Order.first(:include => :line_items).events # => contains duplicates
Order.first(:include => :line_items).event_ids # => contains duplicate IDs

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages