0
多対多リレーションシップのユニークな関係を得るために、 - > {distinct}の使い方を知っています。私は関係をHAS_MANYする必要があると使用したい私の場合は複数のhas_many:throughとdistinct
- >最後の1に{明確な}:コードで
PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
LINE 1: ...roup_provider_pivots"."provider_id" = $1 ORDER BY LOWER(agen...
:
has_many :group_provider_pivots
has_many :groups, through: :group_provider_pivots, dependent: :destroy
has_many :agencies, -> { distinct }, through: :groups
これは私にエラーを与えます:
<% @agencies.each do |agency| %>
個別の部分を削除するとすべて動作しますが、独自の代理店はありません。