Permalink
Browse files

Route to the full namespaced resource when generating a controller.

For example:
rails generate controller foo/bar index

should generate:
get 'foo/bar/index'

previously it generated:
get 'bar/index'
  • Loading branch information...
1 parent d5fe242 commit 2fa841aa17d924610d963ad404d4af2b59e6de0a @parndt committed Aug 21, 2012
@@ -9,8 +9,9 @@ def create_controller_files
end
def add_routes
+ route_path = (class_path | [file_name]).join '/'
actions.reverse.each do |action|
- route %{get "#{file_name}/#{action}"}
+ route %{get "#{route_path}/#{action}"}
end
end
@@ -60,7 +60,8 @@ def test_invokes_default_template_engine
def test_routes_should_not_be_namespaced
run_generator
- assert_file "config/routes.rb", /get "account\/foo"/, /get "account\/bar"/
+ assert_file "config/routes.rb", /get "test_app\/account\/foo"/,
+ /get "test_app\/account\/bar"/
end
#
def test_invokes_default_template_engine_even_with_no_action

0 comments on commit 2fa841a

Please sign in to comment.