Skip to content
Browse files

reload_routes! is part of the public API and should not be removed.

  • Loading branch information...
1 parent 609849a commit 7b0c592e38e4b1d370e04d856d245f825dfa9cfe @josevalim josevalim committed Oct 2, 2010
View
4 railties/lib/rails/application.rb
@@ -81,6 +81,10 @@ def eager_load! #:nodoc:
super
end
+ def reload_routes!
+ routes_reloader.reload!
+ end
+
def routes_reloader
@routes_reloader ||= RoutesReloader.new
end
View
6 railties/lib/rails/application/routes_reloader.rb
@@ -8,7 +8,7 @@ def initialize
def blocks
@blocks ||= {}
end
- private
+
def reload!
clear!
load_blocks
@@ -18,6 +18,8 @@ def reload!
revert
end
+ protected
+
def clear!
routers.each do |routes|
routes.disable_clear_and_finalize = true
@@ -32,7 +34,7 @@ def load_blocks
end
def load_paths
- paths.each { |path| load(path) }
+ paths.each { |path| load(path) }
end
def finalize!
View
9 railties/test/application/routing_test.rb
@@ -209,7 +209,7 @@ def baz
end
app_file 'config/routes.rb', <<-RUBY
- AppTemplate::Application.routes.draw do |map|
+ AppTemplate::Application.routes.draw do
match 'foo', :to => ::InitializeRackApp
end
RUBY
@@ -218,6 +218,13 @@ def baz
assert_equal "InitializeRackApp", last_response.body
end
+ test 'reload_routes! is part of Rails.application API' do
+ app("development")
+ assert_nothing_raised do
+ Rails.application.reload_routes!
+ end
+ end
+
test 'resource routing with irregular inflection' do
app_file 'config/initializers/inflection.rb', <<-RUBY
ActiveSupport::Inflector.inflections do |inflect|

0 comments on commit 7b0c592

Please sign in to comment.
Something went wrong with that request. Please try again.