On Tuesday, April 2, 2019 at 12:42:55 AM UTC-7, [email protected] wrote:
>
> Hi,
>
>
> I want to be able to use group_by instead of distinct in those situations :
>
> many_to_many :models,
>              join_table: :submodels,
>              distinct: :on
>
> many_through_many :makes,
>                   [
>                     [:submodels, :category_id, :model_id],
>                     [:models, :id, :make_id]
>                   ],
>                   distinct: true
>
> Any ideas ?
>

All associations methods can take a block for customizing the association 
dataset:

many_through_many :makes,
                  [
                    [:submodels, :category_id, :model_id],
                    [:models, :id, :make_id]
                  ] do |ds|
  ds.group(:column1, :column2)
end

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to