If you’ve been using ActiveAdmin to manage your administration interfaces in Rails you might have come across the need to get rid of some of the default REST actions. Maybe your model is simple enough that it doesn’t need a “show” view, or perhaps you only want admins to be able to update user-generated content but not create it.
ActiveAdmin’s documentation doesn’t cover how to remove default REST actions, and so you might be tempted to simply replace the action links in your views to “hide” those actions, but that’s not a very pretty solution. Fortunately the API has a nice way of achieving this, you simply have to specify which actions you want using actions in the body of your admin definition, e.g.:
ActiveAdmin.register Moderation do # Remove default REST actions except index, show and update actions :index, :show, :update end
This actions method is actually a method of InheritedResources, a gem ActiveAdmin is built upon, and so it supports this other syntax:
ActiveAdmin.register Moderation do # Remove create and show actions actions :all, :except => [:create, :show] end
I hope you found this useful.