我尝试限制关联的范围,以便用户在编辑关系时看不到已发送的提醒。不过,我希望他们能够在'show'视图中看到,但不能在'edit'视图中看到。RailsAdmin中的范围关联
我不能让范围工作在每个字段的基础上。我可以将整个has_many调用的范围限定在proc范围内,但这不会让我在'show'页面上显示结果,因为它是模型范围的。这里是我当前的代码,这似乎不是基于RailsAdmin维基工作:
group :reminders do
label 'Reminders'
field :reminders do
active true
associated_collection_scope do
Proc.new { |scope|
scope = scope.where(sent: false)
}
end
end
end