While there doesn’t appear to be explicit support for managing the buttons that appear in the top right of active admin (“New Share”, “Delete”, etc.) I did some digging and managed to find a solution.

ActiveAdmin.register Share do
action_item only:[:show] do
link_to "Message Customers", new_admin_share_blast_path(share_blast:{share_id:share})
end
end

Calling the action_item method will print the contents of the block as a button in the area in question. You can control which pages you would like the custom action item to be displayed on by passing a hash with either an :except or :only key.

If you are getting routing issues with models using acts_as_url from Stringex, but on in your tests, and only tests that use Mocha’s stubbing methods, this is for you.

Stringex does all of its acts_as_url crunching in before_validation callbacks. If you are stubbing the :valid? method, that is your problem. Mocha’s stubbing method actually rewrites the method being stubbed, therefore, unless you stub the :valid? method to actually call it’s callbacks you will no longer get all the handy url setting done by Stringex.

test/test_helper.rb:

require 'rubygems'
require 'spork'
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect.
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'mocha'
# =====================
# = Integration Tests =
# =====================
require "capybara/rails"
module ActionController
class IntegrationTest
include Capybara::DSL
end
end
# ===============
# = Other Tests =
# ===============
class ActiveSupport::TestCase
fixtures :all
end
end
Spork.each_run do
# This code will be run each time you run your specs.
end

If you are using Active Admin you are going to want to include a little patch in your each_run block to avoid getting an “undefined method: view_factory” error: