我正在使用 ember 前端和使用 jsonapi-resources 构建 rails api 的测试应用程序。我在 rails 应用程序中的路线定义如下
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
jsonapi_resources :books
jsonapi_resources :authors
jsonapi_resources :publishing_houses
end
但是我注意到了一些奇怪的事情。如果我像这样去publishing_houses 的路径:http://localhost:3000/publishing_houses它说路由/页面不存在。但是,如果我在出版社之间用破折号而不是下划线访问http://localhost:3000/publishing-houses,我会得到我想要的响应。
问题出在我的 ember 应用程序中,我检查了控制台,它使用以下 url 请求数据:http://localhost:3000/publishing_houses和下划线,所以我的 ember 请求中没有任何数据。
这种行为有原因吗?还是我做错了什么?