Skip to content

Commit

Permalink
Removed deprecated router API from railties
Browse files Browse the repository at this point in the history
  • Loading branch information
drogus committed Sep 5, 2010
1 parent 7c50454 commit e6b93fa
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 25 deletions.
11 changes: 0 additions & 11 deletions railties/lib/rails/engine.rb
Expand Up @@ -399,17 +399,6 @@ def config
end
end

# DEPRECATED: Remove in 3.1
initializer :add_routing_namespaces do |app|
paths.app.controllers.to_a.each do |load_path|
load_path = File.expand_path(load_path)
Dir["#{load_path}/*/**/*_controller.rb"].collect do |path|
namespace = File.dirname(path).sub(/#{Regexp.escape(load_path)}\/?/, '')
app.routes.controller_namespaces << namespace unless namespace.empty?
end
end
end

# I18n load paths are a special case since the ones added
# later have higher priority.
initializer :add_locales do
Expand Down
4 changes: 2 additions & 2 deletions railties/test/application/initializers/i18n_test.rb
Expand Up @@ -74,7 +74,7 @@ def assert_no_fallbacks
YAML

app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do |map|
AppTemplate::Application.routes.draw do
match '/i18n', :to => lambda { |env| [200, {}, [I18n.t(:foo)]] }
end
RUBY
Expand Down Expand Up @@ -147,4 +147,4 @@ def assert_no_fallbacks
assert_fallbacks :ca => [:ca, :"es-ES", :es, :'en-US', :en]
end
end
end
end
2 changes: 1 addition & 1 deletion railties/test/application/loading_test.rb
Expand Up @@ -70,7 +70,7 @@ class Post < ActiveRecord::Base
MODEL

app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do |map|
AppTemplate::Application.routes.draw do
match '/load', :to => lambda { |env| [200, {}, Post.all] }
match '/unload', :to => lambda { |env| [200, {}, []] }
end
Expand Down
16 changes: 8 additions & 8 deletions railties/test/application/routing_test.rb
Expand Up @@ -33,7 +33,7 @@ def index
RUBY

app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do |map|
AppTemplate::Application.routes.draw do
match ':controller(/:action)'
end
RUBY
Expand Down Expand Up @@ -91,7 +91,7 @@ def foo_or_bar?
RUBY

app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do |map|
AppTemplate::Application.routes.draw do
match ':controller(/:action)'
end
RUBY
Expand All @@ -102,7 +102,7 @@ def foo_or_bar?

test "mount rack app" do
app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do |map|
AppTemplate::Application.routes.draw do
mount lambda { |env| [200, {}, [env["PATH_INFO"]]] }, :at => "/blog"
# The line below is required because mount sometimes
# fails when a resource route is added.
Expand Down Expand Up @@ -132,7 +132,7 @@ def index
RUBY

app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do |map|
AppTemplate::Application.routes.draw do
match ':controller(/:action)'
end
RUBY
Expand Down Expand Up @@ -164,7 +164,7 @@ def index
RUBY

app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do |map|
AppTemplate::Application.routes.draw do
match 'admin/foo', :to => 'admin/foo#index'
match 'foo', :to => 'foo#index'
end
Expand Down Expand Up @@ -192,7 +192,7 @@ def baz
RUBY

app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do |map|
AppTemplate::Application.routes.draw do
match 'foo', :to => 'foo#bar'
end
RUBY
Expand Down Expand Up @@ -223,7 +223,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
Expand All @@ -240,7 +240,7 @@ def baz
RUBY

app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do |map|
AppTemplate::Application.routes.draw do
resources :yazilar
end
RUBY
Expand Down
2 changes: 1 addition & 1 deletion railties/test/railties/mounted_engine_test.rb
Expand Up @@ -14,7 +14,7 @@ def setup
@plugin = engine "blog"

app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do |map|
AppTemplate::Application.routes.draw do
match "/engine_route" => "application_generating#engine_route"
match "/engine_route_in_view" => "application_generating#engine_route_in_view"
match "/url_for_engine_route" => "application_generating#url_for_engine_route"
Expand Down
4 changes: 2 additions & 2 deletions railties/test/railties/shared_tests.rb
Expand Up @@ -178,7 +178,7 @@ def index
RUBY

app_file "config/routes.rb", <<-RUBY
AppTemplate::Application.routes.draw do |map|
AppTemplate::Application.routes.draw do
match 'foo', :to => 'foo#index'
end
RUBY
Expand All @@ -192,7 +192,7 @@ def index
RUBY

@plugin.write "config/routes.rb", <<-RUBY
Rails.application.routes.draw do |map|
Rails.application.routes.draw do
match 'foo', :to => 'bar#index'
match 'bar', :to => 'bar#index'
end
Expand Down

0 comments on commit e6b93fa

Please sign in to comment.