【发布时间】:2013-08-12 20:29:57
【问题描述】:
我正在尝试覆盖新/编辑表单的 belongs_to 下拉菜单的默认顺序。我想订购belongs_to关系来命名而不是默认的id desc。
基于 wiki (https://github.com/sferik/rails_admin/wiki/Associations-scoping) 我有这个:
field :theme do
associated_collection_cache_all false
associated_collection_scope do
Proc.new { |scope|
scope = scope.reorder("themes.name ASC")
}
end
end
end
在提取语句时似乎忽略了重新排序。
【问题讨论】: