简体   繁体   English

Rails active_admin控制器

[英]Rails active_admin controller

How can i set routes for controller defined in active_admin gem. 如何为active_admin gem中定义的控制器设置路由。

In active_admin, links.rb i have: 在active_admin中,links.rb我有:

controller do

    def admin_links

          //some code
    end
end

and then i try to do routes for it: 然后我尝试为此做路线:

scope '/admin_links' do

    put...??
end

But i just dont know what controller should i call. 但是我只是不知道我应该打电话给哪个控制器。 Can anybody help? 有人可以帮忙吗?

controller do is meant to overwrite existing actions. controller do旨在覆盖现有操作。

If you want to add actions, use either member_action or collection_action . 如果要添加动作,请使用member_actioncollection_action

Doc is here. Doc在这里。


since you use PUT verb, you'll have to do: 由于您使用PUT动词,因此您必须执行以下操作:

member_action :admin_links, method: 'put' do
  # your action code here
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM