Skip to content

Commit

Permalink
Modifying load_routes! so it loads clearance routes after rails routes
Browse files Browse the repository at this point in the history
  • Loading branch information
qrush committed Apr 10, 2009
1 parent 0e8d1a6 commit ce1bffa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/routes.rb → config/clearance_routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
10 changes: 10 additions & 0 deletions lib/clearance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.