Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Fix routing for Devise on root namespace #1809

merged 1 commit into from

3 participants


This PR fixes session logout routing by ensuring that Devise routes have higher priority than Active Admin routes. Before, I would have to manually reorder my routes file, or users would be greeted with RecordNotFound : Couldn't find User with id=logout when trying to log out.

If you're curious, the problem originally stemmed from the route function. It only ever inserts routes at the top of the file. Devise runs first, using route which puts it at the top, then we use the very same function to put ours at the top.

If there is a real way to write tests for this, please let me know.


Looks like this is hard to test. Anyone can test this by hand?


Well I did :)
Multiple times

@gregbell gregbell merged commit cf2fc16 into activeadmin:master
@seanlinsley seanlinsley deleted the unknown repository branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 8, 2012
  1. @seanlinsley
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/generators/active_admin/install/install_generator.rb
6 lib/generators/active_admin/install/install_generator.rb
@@ -27,7 +27,11 @@ def setup_directory
def setup_routes
- route "ActiveAdmin.routes(self)"
+ if ARGV.include? "--skip-users"
+ route "ActiveAdmin.routes(self)"
+ else # Ensure Active Admin routes occur after Devise routes so that Devise has higher priority
+ inject_into_file "config/routes.rb", "\n ActiveAdmin.routes(self)", :after => /devise_for.*/
+ end
def create_assets
Something went wrong with that request. Please try again.