2014-02-12 22 views
1

使用Rails 3.2.12,active_admin 0.6.2/0.6.3,我有我的ActiveAdmin初始化禁用批處理動作:如何刪除activeadmin的批處理動作路線

config.batch_actions = false 

然而,rake routes顯示了批量行動路線我所有註冊的ActiveAdmin控制器:

$ rake routes | grep batch 
      batch_action_admin_admin_users POST  /admin/admin_users/batch_action(.:format)            admin/admin_users#batch_action 
       batch_action_admin_members POST  /admin/members/batch_action(.:format)             admin/members#batch_action 
      batch_action_admin_sales_agents POST  /admin/sales_agents/batch_action(.:format)            admin/sales_agents#batch_action 
       batch_action_admin_comments POST  /admin/comments/batch_action(.:format)             admin/comments#batch_action 

如何刪除這些路由?

我試圖猴補丁this code有:

post :batch_action if config.batch_actions 

,但沒有奏效。

編輯:下面的答案都說得好。有一個PR fixing this

回答

0

查看源代碼here後,我意識到合適的猴子補丁會使用config.batch_actions_enabled?

+1

只是想指出,艾薩克提交了一個修復這個修補程序,它已被合併到主。謝謝Issac! –

0

我已經分析了ActiveAdmin的來源。這是我found

def resource_routes(config) 
    # Some code here... 
    case config 
    when ::ActiveAdmin::Resource 
    resources config.resource_name.route_key, :only => config.defined_actions do 
     member do 
     config.member_actions.each &build_action 
     end 

     collection do 
     config.collection_actions.each &build_action 
     post :batch_action 
     end 
    end 
    # Code continues.. 
end 

ActiveAdmin根本沒有爲CONFIGRATION選項。它總是生成批量路由。