Skip to content

fix logout bug#15

Merged
Fivell merged 2 commits into
mainfrom
logout-accepts-post
Jun 3, 2026
Merged

fix logout bug#15
Fivell merged 2 commits into
mainfrom
logout-accepts-post

Conversation

@Fivell
Copy link
Copy Markdown
Member

@Fivell Fivell commented Jun 3, 2026

The mounted /admin/logout was DELETE-only. AA's default logout_link_method is :get (rails-ujs ships it as POST), so Sign Out 404'd on every click for AA 3 hosts.

Now mirrors AA's own Devise integration — accepts Devise.sign_out_via + ActiveAdmin.application.logout_link_method. Re-read at route-draw time so reload_routes! picks up host overrides. AA 4 dropped the setting; covered by respond_to?.

ActiveAdmin renders the Sign Out link with whatever
ActiveAdmin.application.logout_link_method is configured to — default
:get. The gem mounted /admin/logout as DELETE only, so the rendered
<a data-method="get"> link going through rails-ujs 404'd on every
Sign Out attempt on hosts that keep AA defaults.

Next commit will mirror what AA's own Devise integration does
(lib/active_admin/devise.rb) and accept whatever methods
Devise.sign_out_via + ActiveAdmin.application.logout_link_method
combine to.
@Fivell Fivell force-pushed the logout-accepts-post branch 3 times, most recently from 18de470 to f421835 Compare June 3, 2026 12:00
@Fivell Fivell changed the title Accept GET/POST/DELETE on /admin/logout (Sign Out broken on default AA) fix logout bug Jun 3, 2026
@Fivell Fivell force-pushed the logout-accepts-post branch 3 times, most recently from 17d7dd9 to a321f52 Compare June 3, 2026 12:07
Read whatever methods Devise.sign_out_via and
ActiveAdmin.application.logout_link_method combine to (same set AA's
own Devise integration uses in lib/active_admin/devise.rb) and mount
the destroy route with `via:` that list.

Host stays in control — keep AA defaults and the gem mounts a :get
logout; set `config.logout_link_method = :delete` and the gem mounts
:delete. This block runs in after_initialize, after the host's
config/initializers/active_admin.rb has set its value.

Turns the failing spec from the previous commit green.
@Fivell Fivell force-pushed the logout-accepts-post branch from a321f52 to c734631 Compare June 3, 2026 12:08
@Fivell Fivell merged commit 1b0cc65 into main Jun 3, 2026
6 checks passed
@Fivell Fivell deleted the logout-accepts-post branch June 3, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant