Permalink
Browse files

Warn user if isolated engine routes

  • Loading branch information...
1 parent ff19af1 commit e01625da83ae2dda53df273781d32ae0c15dbf07 @felipeelias felipeelias committed Oct 13, 2012
Showing with 7 additions and 0 deletions.
  1. +1 −0 lib/doorkeeper/engine.rb
  2. +6 −0 lib/doorkeeper/rails/routes.rb
View
@@ -1,6 +1,7 @@
module Doorkeeper
class Engine < Rails::Engine
initializer "doorkeeper.routes" do
+ Doorkeeper::Rails::Routes.warn_if_using_mount_method!
Doorkeeper::Rails::Routes.install!
end
@@ -15,6 +15,12 @@ def self.install!
ActionDispatch::Routing::Mapper.send :include, Doorkeeper::Rails::Routes::Helper
end
+ def self.warn_if_using_mount_method!
+ if File.read(::Rails.root + 'config/routes.rb') =~ %r[mount Doorkeeper::Engine]
+ warn "\n[DOORKEEPER] `mount Doorkeeper::Engine` is not being used anymore. Please replace it with `use_doorkeeper` in your /config/routes.rb file\n"
+ end
+ end
+
attr_accessor :routes
def initialize(routes, &options)

0 comments on commit e01625d

Please sign in to comment.