我在active_admin中使用了awesome_nested_set。但是我发现active_admin找不到nested_set_options方法
我的active_admin代码
ActiveAdmin.register Category do
form do |f|
f.inputs "Category Details" do
f.input :name, :label => "Category name"
f.input :parent_id, :label => "Parent Category", :as => :select, :collection => nested_set_options(Category, @category) {|i| "#{'-' * i.level} #{i.name}" }
end
f.buttons
end
end
答案 0 :(得分:2)
试
:as => :select, :collection => f.template.nested_set_options(Category, @category) {|i| "#{'-' * i.level} #{i.name}" }
在aa~formtastic dsl bridge中你可以从f.template访问视图助手