ActiveAdmin 操作 [英] ActiveAdmin actions
本文介绍了ActiveAdmin 操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法在模型的 ActiveAdmin 索引页面中指定允许的操作,例如:
is there a way to specify in ActiveAdmin's index page of a model what actions are allowed, things like:
index do
actions :edit
end
index do
actions only: :edit
end
不工作.正确的语法是什么?
do not work. What's the correct syntax?
赞赏.
bundle show activeadmin
/home/muichkine/.rvm/gems/ruby-2.1.2/bundler/gems/active_admin-9cfc45330e5a
推荐答案
使用 actions
添加任何你想要可用的操作(通常放在模型定义下):
Add whatever actions you want to be available by using actions
(it is usually put under model definition):
ActiveAdmin.register YourModel do
actions :index, :show, :create, :edit, :update
如果你想指定某个动作的方法,你可以这样做
If you want to specify the method for certain action, you can do
action_item only: :show do
link_to 'Edit', action: :edit # so link will only be available on show action
end
这篇关于ActiveAdmin 操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文