aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-12-15 10:48:56 -0600
committerJoshua Peek <josh@joshpeek.com>2009-12-15 10:48:56 -0600
commitf0bbc647c2086e9536c9d2b4ea7c4c18fe2edd3e (patch)
tree1aee54fc41f2f0289d8097bdd95b35405ae5c404
parenta4b19277b2a4085da3bb0f1e05584496103eeb2a (diff)
downloadrails-f0bbc647c2086e9536c9d2b4ea7c4c18fe2edd3e.tar.gz
rails-f0bbc647c2086e9536c9d2b4ea7c4c18fe2edd3e.tar.bz2
rails-f0bbc647c2086e9536c9d2b4ea7c4c18fe2edd3e.zip
Procs don't call themselves
Fixes dev mode reloading [#3574 state:resolved]
-rw-r--r--railties/lib/rails/application.rb2
-rw-r--r--railties/test/application/routing_test.rb32
2 files changed, 33 insertions, 1 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index 047d252625..bc74ac8646 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -400,7 +400,7 @@ module Rails
reload_routes!
end
end
- ActionDispatch::Callbacks.before_dispatch { |callbacks| reload_routes }
+ ActionDispatch::Callbacks.before_dispatch { |callbacks| reload_routes.call }
end
end
diff --git a/railties/test/application/routing_test.rb b/railties/test/application/routing_test.rb
index 752218b943..decde056fd 100644
--- a/railties/test/application/routing_test.rb
+++ b/railties/test/application/routing_test.rb
@@ -119,5 +119,37 @@ module ApplicationTests
get '/bar'
assert_equal 'bar', last_response.body
end
+
+ test "reloads routes when configuration is changed" do
+ controller :foo, <<-RUBY
+ class FooController < ActionController::Base
+ def bar
+ render :text => "bar"
+ end
+
+ def baz
+ render :text => "baz"
+ end
+ end
+ RUBY
+
+ app_file 'config/routes.rb', <<-RUBY
+ ActionController::Routing::Routes.draw do |map|
+ match 'foo', :to => 'foo#bar'
+ end
+ RUBY
+
+ get '/foo'
+ assert_equal 'bar', last_response.body
+
+ app_file 'config/routes.rb', <<-RUBY
+ ActionController::Routing::Routes.draw do |map|
+ match 'foo', :to => 'foo#baz'
+ end
+ RUBY
+
+ get '/foo'
+ assert_equal 'baz', last_response.body
+ end
end
end