Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Modifying load_routes! so it loads clearance routes after rails routes

  • Loading branch information...
commit ce1bffa88d4a5108d3f7887eec5f73e755786057 1 parent 0e8d1a6
Nick Quaranto qrush authored
Showing with 11 additions and 1 deletion.
  1. +1 −1  config/{routes.rb → clearance_routes.rb}
  2. +10 −0 lib/clearance.rb
2  config/routes.rb → config/clearance_routes.rb
View
@@ -7,7 +7,7 @@
:controller => 'clearance/sessions',
:only => [:new, :create, :destroy]
- map.resources :users do |users|
+ map.resources :users, :controller => 'clearance/users' do |users|
users.resource :password,
:controller => 'clearance/passwords',
:only => [:create, :edit, :update]
10 lib/clearance.rb
View
@@ -3,3 +3,13 @@
require 'clearance/authentication'
require 'clearance/user'
+
+class ActionController::Routing::RouteSet
+ def load_routes_with_clearance!
+ clearance_routes = File.join(File.dirname(__FILE__), *%w[.. config clearance_routes.rb])
+ add_configuration_file(clearance_routes) unless configuration_files.include? clearance_routes
+ load_routes_without_clearance!
+ end
+
+ alias_method_chain :load_routes!, :clearance
+end
Please sign in to comment.
Something went wrong with that request. Please try again.