Skip to content

Commit

Permalink
Stop route reloading madness. refinery#1599.
Browse files Browse the repository at this point in the history
  • Loading branch information
ugisozols committed May 11, 2012
1 parent 2846e2f commit 8d94901
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 24 deletions.
10 changes: 4 additions & 6 deletions authentication/config/routes.rb
@@ -1,9 +1,3 @@
Refinery::Core::Engine.routes.append do
namespace :admin, :path => 'refinery' do
resources :users, :except => :show
end
end

Refinery::Core::Engine.routes.draw do
begin
require 'devise'
Expand Down Expand Up @@ -35,4 +29,8 @@
raise exc
end
end

namespace :admin, :path => 'refinery' do
resources :users, :except => :show
end
end
3 changes: 0 additions & 3 deletions core/lib/refinery/catch_all_routes.rb

This file was deleted.

16 changes: 4 additions & 12 deletions core/lib/refinery/core/engine.rb
Expand Up @@ -72,8 +72,10 @@ def refinery_inclusion!
end
end

initializer "refinery.routes" do |app|
app.routes_reloader.paths << File.expand_path('../../catch_all_routes.rb', __FILE__)
initializer "refinery.routes", :after => :set_routes_reloader_hook do |app|
Refinery::Core::Engine.routes.append do
get '/refinery/*path' => 'admin/base#error_404'
end
end

initializer "refinery.autoload_paths" do |app|
Expand Down Expand Up @@ -118,16 +120,6 @@ def refinery_inclusion!
config.after_initialize do
Refinery.register_extension(Refinery::Core)
end

# We need to reload the routes here due to how Refinery sets them up
# The different facets of Refinery (dashboard, pages, etc.) append/prepend routes to Core
# *after* Core has been loaded.
#
# So we wait until after initialization is complete to do one final reload
# This then makes the appended/prepended routes available to the application.
config.after_initialize do
Rails.application.routes_reloader.reload!
end
end
end
end
2 changes: 1 addition & 1 deletion dashboard/config/routes.rb
@@ -1,4 +1,4 @@
Refinery::Core::Engine.routes.prepend do
Refinery::Core::Engine.routes.draw do
namespace :admin, :path => 'refinery' do
get 'dashboard', :to => 'dashboard#index', :as => :dashboard

Expand Down
2 changes: 1 addition & 1 deletion images/config/routes.rb
@@ -1,4 +1,4 @@
Refinery::Core::Engine.routes.prepend do
Refinery::Core::Engine.routes.draw do
get '/system/images/*dragonfly', :to => Dragonfly[:refinery_images]

namespace :admin, :path => 'refinery' do
Expand Down
2 changes: 1 addition & 1 deletion resources/config/routes.rb
@@ -1,4 +1,4 @@
Refinery::Core::Engine.routes.prepend do
Refinery::Core::Engine.routes.draw do
get '/system/resources/*dragonfly', :to => Dragonfly[:refinery_resources]

namespace :admin, :path => 'refinery' do
Expand Down
1 change: 1 addition & 0 deletions resources/spec/requests/refinery/admin/resources_spec.rb
Expand Up @@ -125,6 +125,7 @@ module Admin
Rails.application.routes.draw do
mount Refinery::Core::Engine, :at => "/about"
end
Rails.application.routes_reloader.reload!
end

after do
Expand Down

0 comments on commit 8d94901

Please sign in to comment.