想实现效果:prevdetail_tmps 与 m_selectlist 关联后,按照 prevdetail_tmps.day_from, m_selectlists.sort_no 排序
下面的写法会报错:
has_many :prevdetail_tmps, -> { includes(:m_selectlist).order('day_from, m_selectlists.sort_no') }, :dependent => :destroy
错误信息:
SELECT "prevdetail_tmps".* FROM "prevdetail_tmps" WHERE "prevdetail_tmps"."del_flg" = 0 AND "prevdetail_tmps"."shain_tmp_id" = $1 ORDER BY day_from, m_selectlists.sort_no
请问 has_many 的参数 includes 和 order 应该怎么写?