I have the following line in my ActiveRecord model:
class Record < ActiveRecord::Base has_many :users, :through => :record_users, :uniq => true, :order => "record_users.index ASC"
This is intended to allow me to read records. so that I order the use of the index field in the record_users model.
The problem is that this does not work in PostgreSQL with the following error:
ActionView::TemplateError (PGError: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
Is there any way to fix the statement so that it works?
ruby-on-rails activerecord postgresql has-many
cmaughan
source share