Skip to content
This repository
Browse code

Modifying load_routes! so it loads clearance routes after rails routes

  • Loading branch information...
commit ce1bffa88d4a5108d3f7887eec5f73e755786057 1 parent 0e8d1a6
Nick Quaranto qrush authored
2  config/routes.rb → config/clearance_routes.rb
@@ -7,7 +7,7 @@
7 7 :controller => 'clearance/sessions',
8 8 :only => [:new, :create, :destroy]
9 9
10   - map.resources :users do |users|
  10 + map.resources :users, :controller => 'clearance/users' do |users|
11 11 users.resource :password,
12 12 :controller => 'clearance/passwords',
13 13 :only => [:create, :edit, :update]
10 lib/clearance.rb
@@ -3,3 +3,13 @@
3 3
4 4 require 'clearance/authentication'
5 5 require 'clearance/user'
  6 +
  7 +class ActionController::Routing::RouteSet
  8 + def load_routes_with_clearance!
  9 + clearance_routes = File.join(File.dirname(__FILE__), *%w[.. config clearance_routes.rb])
  10 + add_configuration_file(clearance_routes) unless configuration_files.include? clearance_routes
  11 + load_routes_without_clearance!
  12 + end
  13 +
  14 + alias_method_chain :load_routes!, :clearance
  15 +end

0 comments on commit ce1bffa

Please sign in to comment.
Something went wrong with that request. Please try again.