Active admin change default model admin_user

I am starting my first project with Active Admin. To use a different model for my users, I use the following command:

rails generate active_admin:install User 

After that, I make this change in the active_admin initializer:

 config.authentication_method = :authenticate_user! config.current_user_method = :current_user 

I enter the application correctly, but on the home page I get this error:

 undefined method `destroy_admin_user_session_path' for #<ActiveAdmin::Views::HeaderRenderer:0x007ff8fa086a60> 

How can I fix it correctly?

+4
source share
2 answers

Solved by editing the initializer:

 config.logout_link_path = :destroy_user_session_path 
+6
source

This is a complement to @Awea's answer. Use togather with this.

Check the rail routing table for destroy_user_session .

For example, create an auth token to record a route table as follows:

 destroy_user_session DELETE /auth/sign_out(.:format) devise_token_auth/sessions#destroy 

But the default method for the activeadmin :get exit link does not work.

For it to work correctly, add also config / initializers / active_admin.rb and:

 config.logout_link_method = :delete 
+1
source

Source: https://habr.com/ru/post/1393750/


All Articles