Skip to content

Fix routes template indentation#3029

Open
tanakakc wants to merge 1 commit intothoughtbot:mainfrom
tanakakc:fix/routes-indentation
Open

Fix routes template indentation#3029
tanakakc wants to merge 1 commit intothoughtbot:mainfrom
tanakakc:fix/routes-indentation

Conversation

@tanakakc
Copy link
Copy Markdown

Problem

The routes template generates misaligned code in config/routes.rb:

namespace :admin do
    resources :users

    root to: "users#index"
  end

This happens because the template includes extra indentation that compounds with Rails' route() method, which automatically adds indentation when injecting routes.

Fix

Adjusted the indentation in routes.rb.erb so that the generated output is properly aligned:

namespace :admin do
  resources :users

  root to: "users#index"
end

Tests

All existing route generator specs pass.

The routes template had extra indentation that resulted in
misaligned code when Rails' route() method applied its own
indentation. The generated routes looked like:

  namespace :admin do
      resources :users

      root to: "users#index"
    end

After this fix:

  namespace :admin do
    resources :users

    root to: "users#index"
  end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant