fix logout bug#15
Merged
Merged
Conversation
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.
18de470 to
f421835
Compare
17d7dd9 to
a321f52
Compare
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.
a321f52 to
c734631
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The mounted
/admin/logoutwas DELETE-only. AA's defaultlogout_link_methodis: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 soreload_routes!picks up host overrides. AA 4 dropped the setting; covered byrespond_to?.