9 Allows you to filter listings by a certain scope.
18 scope :public, if: ->{ current_admin_user.can?(...) }
19 scope "Unapproved", :pending
20 scope("Published") { |books| books.where(:published: true) }
32 You can define custom actions for models.
36 before_filter only: [:show, :edit, :publish] do
37 @post = Post.find(params[:id])
44 member_action :publish, method: :put do
46 redirect_to admin_posts_path, notice: "The post '#{@post}' has been published!"
50 #### Link it in the index
55 link_to 'Publish', publish_admin_post_path(post), method: :put
60 #### And link it in show/edit
63 action_item only: [:edit, :show] do
64 @post = Post.find(params[:id])
65 link_to 'Publish', publish_admin_post_path(post), method: :put
76 column :title, sortable: :name do |post|
84 status_tag "Done" # Gray
85 status_tag "Finished", :ok # Green
86 status_tag "You", :warn # Orange
87 status_tag "Failed", :error # Red
90 ### Disabling 'new post'
93 ActiveAdmin.register Post do
95 # or: config.clear_action_items!