我有以下查询:
Article.joins(:themes => [:users]).where(["articles.user_id != ?",current_user.id]).order("Random()").limit(15).uniq
并给我错误
PG::Error: ERROR: for SELECT DISTINCT,ORDER BY expressions must appear in select list LINE 1: ...s"."user_id" WHERE (articles.user_id != 1) ORDER BY Random() L...
当我更新原来的查询
Article.joins(:themes => [:users]).where(["articles.user_id != ?",current_user.id]).order("Random()").limit(15)#.uniq