Rails路由竞争条件

时间:2017-08-11 01:57:08

标签: ruby-on-rails ruby-on-rails-5.1

有没有人遇到这样的竞争条件?

Started GET "//product_schemas/show?product_id=6aa11af8-9d77-4109-ad5e-9ec91200bfc1" for 127.0.0.1 at 2017-08-11 09:46:00 +1000

Started GET "//products/6aa11af8-9d77-4109-ad5e-9ec91200bfc1" for 127.0.0.1 at 2017-08-11 09:46:00 +1000

Processing by V1::ProductsController#show as JSON
  Parameters: {"id"=>"6aa11af8-9d77-4109-ad5e-9ec91200bfc1"}

Processing by V1::ProductsController#show as JSON
  Parameters: {"id"=>"6aa11af8-9d77-4109-ad5e-9ec91200bfc1"}

这两个请求都是由ProductsController处理的,但是ProductSchemasController应该处理/ product_schemas / show调用。

相关路线

resources :product_schemas, only: [] do
  collection do
    get 'show' => 'product_schemas#show'
  end
end

resources :products do
end

0 个答案:

没有答案