title: Activeadmin Custom Action And Form
body: <p>I want to implement a custom action (notify_all) on my Users activeadmin page that when clicked will display a form which when submitted will route to another custom action (send_notification_to_all). So far I have been unable to get the second part working.</p>
  
  <p>admin/users.rb:</p>
  
  <pre><code>ActiveAdmin.register User do
  
    action_item :only =&gt; :index do
      link_to 'Notify All', notify_all_admin_users_path
    end
  
    collection_action :notify_all, :method =&gt; :get do
      puts "notifying...."
      end
  
    collection_action :send_notification_to_all, :method =&gt; :post do
      puts "sending notification...."
    end
  
  
  
  end
  </code></pre>
  
  <p>When Notify All button is clicked, following view is rendered.
  views/admin/users/notify_all.html.erb</p>
  
  <pre><code>&lt;form action="send_notification_to_all" method="post"&gt;
    &lt;div&gt;&lt;textarea rows="10" cols="100" placeholder="Enter message here"&gt;&lt;/textarea&gt;&lt;/div&gt;
    &lt;div&gt;&lt;input type="submit"&gt;&lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>When this form is submitted, I get a 401 Unauthorized error:</p>
  
  <pre><code>Started POST "/admin/users/send_notification_to_all" for 127.0.0.1 at 2014-02-12 14:08:27 -0600
  Processing by Admin::UsersController#send_notification_to_all as HTML
  WARNING: Can't verify CSRF token authenticity
    AdminUser Load (0.8ms)  SELECT "admin_users".* FROM "admin_users" WHERE "admin_users"."id" = 1 LIMIT 1
     (0.3ms)  BEGIN
     (26.6ms)  UPDATE "admin_users" SET "remember_created_at" = NULL, "updated_at" = '2014-02-12 14:08:27.394791' WHERE "admin_users"."id" = 1
     (20.3ms)  COMMIT
  Completed 401 Unauthorized in 108.3ms
  </code></pre>
  
  <p>Is it possible to do what I am trying to do though active admin?</p>