0

I have using awesome_nested_set with active_admin. But I found that active_admin can't find nested_set_options method

My active_admin code

    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
4

1 回答 1

2

尝试

:as => :select, :collection => f.template.nested_set_options(Category, @category) {|i| "#{'-' * i.level} #{i.name}" }

在 aa ~ formtastic dsl 桥中,您可以从 f.template 访问视图助手

于 2012-01-12T15:11:18.203 回答