Permalink
Browse files

Rewrite implementation of the mount_sextant method

  • Loading branch information...
1 parent 0a14b0d commit d9466ead26bf02617ed570bf994bac1fcd7b1260 @menkel menkel committed May 29, 2012
Showing with 12 additions and 16 deletions.
  1. +11 −0 lib/rails/routes.rb
  2. +1 −1 lib/sextant.rb
  3. +0 −4 lib/sextant/engine.rb
  4. +0 −11 lib/sextant/routing.rb
View
11 lib/rails/routes.rb
@@ -0,0 +1,11 @@
+module ActionDispatch::Routing
+ class Mapper
+ # Includes mount_sextant method for routes. This method is responsible to
+ # generate all needed routes for sextant
+ def mount_sextant
+ namespace :rails do
+ resources :routes, :only => [:index, :show]
+ end
+ end
+ end
+end
View
2 lib/sextant.rb
@@ -1,6 +1,6 @@
require 'rails/application/route_inspector'
require 'sextant/engine'
-require 'sextant/routing'
+require 'rails/routes'
module Sextant
def self.format_routes(routes = all_routes)
View
4 lib/sextant/engine.rb
@@ -1,9 +1,5 @@
module Sextant
class Engine < Rails::Engine
isolate_namespace Sextant
-
- initializer "Sextant mount routes" do
- ActionDispatch::Routing::Mapper.send(:include, Sextant::Routing)
- end
end
end
View
11 lib/sextant/routing.rb
@@ -1,11 +0,0 @@
-module Sextant
- #convenience methods for Rails routing
- module Routing
- # function for mounting the sextant rails engine to root
- def mount_sextant
- namespace :rails do
- resources :routes, :only => [:index, :show]
- end
- end
- end
-end

0 comments on commit d9466ea

Please sign in to comment.