I have some rails 3 routes that worked perfectly, for versioning an API with different module:
Rails.application.routes.draw do
scope module: :v2, constraints: Constraints::ApiVersion.new(versions: [2, 2.1], default: false) do
scope 'feedback/:id' do
get 'summary', controller:'summary', action: 'summary', as: 'response_summary'
end
end
scope module: :v1, constraints: Constraints::ApiVersion.new(versions: 1, default: true) do
scope 'feedback/:id' do
get 'summary', controller:'summary', action: 'summary', as: 'response_summary'
end
end
end
But now in rails 5, I get this error:
Invalid route name, already in use: 'response_summary' (ArgumentError) You may have defined two routes with the same name using the
:as
option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created withresources
as explained here: http://guides.rubyonrails.org/routing.html#restricting-the-routes-created
Is there anyway to keep the :as
the same in Rails 5?
Aucun commentaire:
Enregistrer un commentaire