Skip to content

Commit

Permalink
Move engine routes to initializer, to avoid NameError in the config/r…
Browse files Browse the repository at this point in the history
…outes without :require in Gemfile. Fix #71

  ...bundler/gems/garage-25c84afe4bc4/config/routes.rb:18:in `<top (required)>': uninitialized constant Garage::Webhook::Engine (NameError)
  • Loading branch information
miyagawa committed Nov 11, 2013
1 parent 4dac564 commit 50531db
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
16 changes: 0 additions & 16 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,16 +0,0 @@
Garage::Docs::Engine.routes.draw do
root :to => 'resources#index', as: nil
resources :resources do
collection do
get 'console'
post 'authenticate'
get 'callback'
post 'callback'
end
end
end

Garage::Meta::Engine.routes.draw do
resources :services
resources :docs
end
14 changes: 14 additions & 0 deletions lib/garage/docs/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ module Garage
module Docs
class Engine < ::Rails::Engine
isolate_namespace Garage::Docs

initializer "garage.docs.engine.routes" do
Engine.routes.append do
root :to => 'resources#index', as: nil
resources :resources do
collection do
get 'console'
post 'authenticate'
get 'callback'
post 'callback'
end
end
end
end
end
end
end
7 changes: 7 additions & 0 deletions lib/garage/meta/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ module Garage
module Meta
class Engine < ::Rails::Engine
isolate_namespace Garage::Meta

initializer "garage.meta.engine.routes" do
Engine.routes.append do
resources :services
resources :docs
end
end
end
end
end

0 comments on commit 50531db

Please sign in to comment.