PostgreSQL, Rails and :order => problem

后端 未结 3 1321
灰色年华
灰色年华 2021-01-02 16:32

I have the following line in my ActiveRecord model:

class Record < ActiveRecord::Base
    has_many :users, :through => :record_users, :uniq => true,         


        
3条回答
  •  萌比男神i
    2021-01-02 16:54

    I ran into something similar before and I believe it's an AR bug related to PGSQL (https://rails.lighthouseapp.com/projects/8994/tickets/1711-has-many-through-association-with-order-causes-a-sql-error-with-postgresql).

    I got around it by dropping the DISTINCT (:uniq) directive and resolved the uniq records another way. Kind of a bummer though.

提交回复
热议问题