Permalink
Browse files

Merge pull request #14195 from robin850/issue-14079

Avoid namespacing routes inside engines
Conflicts:
	railties/CHANGELOG.md

Closes #15376
  • Loading branch information...
guilleiguaran authored and rafaelfranca committed Mar 1, 2014
1 parent c345365 commit 8ac5b94988f17d3a862631e363d3b8d8fc758625
View
@@ -1,3 +1,13 @@
* Avoid namespacing routes inside engines.
Mountable engines are namespaced by default so the generated routes
were too while they should not.
Fixes #14079.
*Yves Senn*, *Carlos Antonio da Silva*, *Robin Dupret*
## Rails 4.1.2 (unreleased) ##
* Load database configuration from the first `database.yml` available in paths.
@@ -27,11 +27,11 @@ def add_routes
# end
# end
def generate_routing_code(action)
depth = class_path.length
depth = regular_class_path.length
# Create 'namespace' ladder
# namespace :foo do
# namespace :bar do
namespace_ladder = class_path.each_with_index.map do |ns, i|
namespace_ladder = regular_class_path.each_with_index.map do |ns, i|
indent("namespace :#{ns} do\n", i * 2)
end.join
@@ -355,6 +355,18 @@ def test_skipping_gemfile_entry
FileUtils.rm gemfile_path
end
def test_generating_controller_inside_mountable_engine
run_generator [destination_root, "--mountable"]
capture(:stdout) do
`#{destination_root}/bin/rails g controller admin/dashboard foo`
end
assert_file "config/routes.rb" do |contents|
assert_match(/namespace :admin/, contents)
assert_no_match(/namespace :bukkit/, contents)
end
end
protected
def action(*args, &block)

0 comments on commit 8ac5b94

Please sign in to comment.