让活跃的管理员对关联的子列进行排序很痛苦。我有一个具有相关“用户”的个人资料。
ActiveAdmin.register Profile, as: "Member" do
def scoped_collection
end_of_association_chain.includes(:user)
end
column "Referral", sortable: 'user.referrals' do |member|
member.user.referrals
end
--error when sorting---
PG::Error: ERROR: syntax error at or near "."
LINE 1: ... "users"."id" = "profiles"."user_id" ORDER BY user.referrals...
^
: SELECT "profiles"."id" AS t0_r0, "profiles"."actor_id" AS t0_r1,