mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Procs don't call themselves
Fixes dev mode reloading [#3574 state:resolved]
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user