Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom route for activeadmin actions?

I'm making a page with activeadmin to update password of current user. I have a non-persisted model to check validation of password, etc. My problem is that when I try

ActiveAdmin.register UpdatePassword do
    actions :edit, :update
end

It creates the routes /update_passwords/:id and /update_passwords/:id/edit.

I want to change those routes to /update_passwords via get and put.

Is there any way to change that?

like image 366
Bishma Stornelli Avatar asked Sep 11 '12 13:09

Bishma Stornelli


1 Answers

I couldn't find a way to do it with activeadmin but defining the routes manually worked:

#config/routes.rb
match "/admin/update_passwords" => 'admin/update_passwords#edit', via: :get, as: "admin_update_passwords"
match "/admin/update_passwords" => 'admin/update_passwords#update', via: :post
like image 115
Bishma Stornelli Avatar answered Sep 24 '22 17:09

Bishma Stornelli