rubocop / rails-style-guide

A community-driven Ruby on Rails style guide
http://rails.rubystyle.guide
6.47k stars 1.06k forks source link

Are blank routes preferred or routes with `/` #336

Open arianf opened 1 year ago

arianf commented 1 year ago

When trying to add a route at the root of a resource, what is preferred:

resources :legal, only: %i[index] do
  collection do
    post '', action: :legal_submit

    # OR

    post '/', action: :legal_submit
  end
end

Both go to the same route: POST /legal.

It would be nice if rails supported omitting the first param like post action: :legal_submit