Permalink
Browse files

Modifying load_routes! so it loads clearance routes after rails routes

  • Loading branch information...
1 parent 0e8d1a6 commit ce1bffa88d4a5108d3f7887eec5f73e755786057 @qrush qrush committed Apr 10, 2009
Showing with 11 additions and 1 deletion.
  1. +1 −1 config/{routes.rb → clearance_routes.rb}
  2. +10 −0 lib/clearance.rb
View
2 config/routes.rb → config/clearance_routes.rb
@@ -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]
View
10 lib/clearance.rb
@@ -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

0 comments on commit ce1bffa

Please sign in to comment.