diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-09-01 19:31:29 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-09-03 22:59:15 +0200 |
commit | 6c906bf59111e09997787c1d4c5ba2ec2b783cdd (patch) | |
tree | 396e7639ed56654a76fc95742bf5cf8baee6831d /railties | |
parent | b8d6dc3c84321c751ab2ca8232e1e3fb332a844c (diff) | |
download | rails-6c906bf59111e09997787c1d4c5ba2ec2b783cdd.tar.gz rails-6c906bf59111e09997787c1d4c5ba2ec2b783cdd.tar.bz2 rails-6c906bf59111e09997787c1d4c5ba2ec2b783cdd.zip |
Use default_scope in isolated Engines to not force user to scope his routes
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/engine.rb | 2 | ||||
-rw-r--r-- | railties/test/railties/engine_test.rb | 18 | ||||
-rw-r--r-- | railties/test/railties/mounted_engine_test.rb | 8 |
3 files changed, 12 insertions, 16 deletions
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index be63363242..1990aa5261 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -303,6 +303,8 @@ module Rails end end + self.routes.default_scope = {:module => name} + self.namespaced = true end diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index 73d9b61719..3049011477 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -390,14 +390,12 @@ module RailtiesTest @plugin.write "config/routes.rb", <<-RUBY Bukkits::Engine.routes.draw do - scope(:module => :bukkits) do - match "/foo" => "foo#index", :as => "foo" - match "/foo/show" => "foo#show" - match "/from_app" => "foo#from_app" - match "/routes_helpers_in_view" => "foo#routes_helpers_in_view" - match "/polymorphic_path_without_namespace" => "foo#polymorphic_path_without_namespace" - resources :posts - end + match "/foo" => "foo#index", :as => "foo" + match "/foo/show" => "foo#show" + match "/from_app" => "foo#from_app" + match "/routes_helpers_in_view" => "foo#routes_helpers_in_view" + match "/polymorphic_path_without_namespace" => "foo#polymorphic_path_without_namespace" + resources :posts end RUBY @@ -514,9 +512,7 @@ module RailtiesTest @plugin.write "config/routes.rb", <<-RUBY Bukkits::Engine.routes.draw do - scope(:module => :bukkits) do - resources :posts - end + resources :posts end RUBY diff --git a/railties/test/railties/mounted_engine_test.rb b/railties/test/railties/mounted_engine_test.rb index 1df6326d26..b1e3e274b8 100644 --- a/railties/test/railties/mounted_engine_test.rb +++ b/railties/test/railties/mounted_engine_test.rb @@ -56,11 +56,9 @@ module ApplicationTests @plugin.write "config/routes.rb", <<-RUBY Blog::Engine.routes.draw do - scope(:module => :blog) do - resources :posts do - get :generate_application_route - get :application_route_in_view - end + resources :posts do + get :generate_application_route + get :application_route_in_view end end RUBY |