出于兴趣,我试图重写
Model.joins{other_model}.uniq
(生成):
=> "SELECT DISTINCT [model].* FROM [model] INNER JOIN [other_model] ON [other_model].[model_id] = [model].[id]"
在纯 Squeel 中,但我能得到的最接近的是
Model.joins{other_model}.select{distinct(id)}
生成:
=> "SELECT DISTINCT [model].[id] FROM [model] INNER JOIN [other_model] ON [other_model].[model_id] = [model].[id]"
我将如何DISTINCT [model].*
在 Squeel 中进行操作?是否可以?
谢谢