dimanche 7 août 2016

ember/rails - Strange behavior in rails route containing an underscore

I'm playing around with a tester app using an ember frontend and using jsonapi-resources to build the rails api. My routes in the rails app are defined as follows

Rails.application.routes.draw do
  # For details on the DSL available within this file, see http://ift.tt/GVpneB
  jsonapi_resources :books
  jsonapi_resources :authors
  jsonapi_resources :publishing_houses
end

However I've noticed something strange. If I go to the path for publishing_houses like so: http://localhost:3000/publishing_houses it says the route/page doesn't exist. However if I go to http://localhost:3000/publishing-houses with a dash instead of an underscore between publishing houses, I get the response that I want.

The problem is in my ember app, I've checked the console and it requests data using this url: http://localhost:3000/publishing_houses with the underscore, so I don't get any data back in my ember request.

Is there a reason for this behavior? Or am I doing something wrong?




Aucun commentaire:

Enregistrer un commentaire