diff options
author | Andrew White <pixeltrix@users.noreply.github.com> | 2015-04-14 08:45:18 +0100 |
---|---|---|
committer | Andrew White <pixeltrix@users.noreply.github.com> | 2015-04-14 08:45:18 +0100 |
commit | 4fb3a55528d9e73c3dc49a838703408a8a33485b (patch) | |
tree | 01a6900b6e89379e607acf07dbe1701c3b3a830e /railties/lib/rails | |
parent | 524d40591eaa2f4d007409bfad386f6b107492eb (diff) | |
parent | d2be2a9166815f862dad24d160c643589e80b259 (diff) | |
download | rails-4fb3a55528d9e73c3dc49a838703408a8a33485b.tar.gz rails-4fb3a55528d9e73c3dc49a838703408a8a33485b.tar.bz2 rails-4fb3a55528d9e73c3dc49a838703408a8a33485b.zip |
Merge pull request #19751 from y-yagi/fix_indent_of_controller
fix indent in routes when using namespaced controllers
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/generators/rails/controller/controller_generator.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/railties/lib/rails/generators/rails/controller/controller_generator.rb b/railties/lib/rails/generators/rails/controller/controller_generator.rb index df615c88b5..6c583e5811 100644 --- a/railties/lib/rails/generators/rails/controller/controller_generator.rb +++ b/railties/lib/rails/generators/rails/controller/controller_generator.rb @@ -13,7 +13,8 @@ module Rails def add_routes unless options[:skip_routes] actions.reverse_each do |action| - route generate_routing_code(action) + # route prepends two spaces onto the front of the string that is passed, this corrects that. + route generate_routing_code(action)[2..-1] end end end @@ -36,12 +37,12 @@ module Rails # namespace :foo do # namespace :bar do namespace_ladder = regular_class_path.each_with_index.map do |ns, i| - indent("namespace :#{ns} do\n", i * 2) + indent(" namespace :#{ns} do\n", i * 2) end.join # Create route # get 'baz/index' - route = indent(%{get '#{file_name}/#{action}'\n}, depth * 2) + route = indent(%{ get '#{file_name}/#{action}'\n}, depth * 2) # Create `end` ladder # end |