Skip to content

Commit

Permalink
Move routes loading to separate file
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Croak <dcroak@thoughtbot.com>
  • Loading branch information
Joshua Clayton authored and Dan Croak committed May 31, 2009
1 parent 3149ffc commit 32498de
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions clearance.gemspec
Expand Up @@ -95,6 +95,7 @@ files:
- lib/clearance/extensions
- lib/clearance/extensions/errors.rb
- lib/clearance/extensions/rescue.rb
- lib/clearance/extensions/routes.rb
- lib/clearance/user.rb
- lib/clearance.rb
- shoulda_macros/clearance.rb
Expand Down
15 changes: 1 addition & 14 deletions lib/clearance.rb
@@ -1,19 +1,6 @@
require 'clearance/extensions/errors'
require 'clearance/extensions/rescue'
require 'clearance/extensions/routes'

require 'clearance/authentication'
require 'clearance/user'

class ActionController::Routing::RouteSet
def load_routes_with_clearance!
lib_path = File.dirname(__FILE__)
clearance_routes = File.join(lib_path, *%w[.. config clearance_routes.rb])
unless configuration_files.include?(clearance_routes)
add_configuration_file(clearance_routes)
end
load_routes_without_clearance!
end

alias_method_chain :load_routes!, :clearance
end

12 changes: 12 additions & 0 deletions lib/clearance/extensions/routes.rb
@@ -0,0 +1,12 @@
class ActionController::Routing::RouteSet
def load_routes_with_clearance!
lib_path = File.dirname(__FILE__)
clearance_routes = File.join(lib_path, *%w[.. .. .. config clearance_routes.rb])
unless configuration_files.include?(clearance_routes)
add_configuration_file(clearance_routes)
end
load_routes_without_clearance!
end

alias_method_chain :load_routes!, :clearance
end

0 comments on commit 32498de

Please sign in to comment.