ActiveAdmin : member_action "approve" on User model
<p>I want to add a member_action named approve on my User model in ActiveAdmin. I looked at docs but everything is different and i'm quite confused about how to do it. Until now, I've only make it to show the approve link (next to View, Edit and Delete).</p>

<p>admin/user.rb : </p>

<pre><code>member_action :approve, method: :post do
    user = User.find params[:id]
    user.approve!
    redirect_to admin_user_path(user), notice: "Approved!"
  end
</code></pre>

<p>and to show the link: </p>

<pre><code>actions defaults: true do |user|
    link_to 'Approve',approve_admin_user_path(user)
end
</code></pre>

<p>models/user.rb :</p>

<pre><code>def approve!
    update(bio_validee: true)
end
</code></pre>

<p>When I click on the link , I have a Routing Error with :</p>

<pre><code>No route matches [GET] "/admin/users/21/approve"
</code></pre>

<p>Here what <code>rake routes</code> does (for admin/users routes): </p>

<pre><code>approve_admin_user POST       /admin/users/:id/approve(.:format)              admin/users#approve
        batch_action_admin_users POST       /admin/users/batch_action(.:format)             admin/users#batch_action
                     admin_users GET        /admin/users(.:format)                          admin/users#index
                                 POST       /admin/users(.:format)                          admin/users#create
                  new_admin_user GET        /admin/users/new(.:format)                      admin/users#new
                 edit_admin_user GET        /admin/users/:id/edit(.:format)                 admin/users#edit
                      admin_user GET        /admin/users/:id(.:format)                      admin/users#show
                                 PATCH      /admin/users/:id(.:format)                      admin/users#update
                                 PUT        /admin/users/:id(.:format)                      admin/users#update
                                 DELETE     /admin/users/:id(.:format)                      admin/users#destroy
</code></pre>

<p>Have I done something wrong? What do I have to add ?
Furthermore, I don't know if I have to use GET, POST, or PUT in </p>

<p><code>member_action :approve, method: :post</code></p>

<p>I don't really get the difference in that case.</p>