2016-06-12 15 views
0

ich resource :products, :path => 'catalog/' meiner routes.rb hinzugefügt, aber mein router wie folgt aussehen:Rails Routen haben keine ID

 products POST /catalog(.:format)       products#create 
    new_products GET /catalog/new(.:format)      products#new 
edit_products GET /catalog/edit(.:format)      products#edit 
       GET /catalog(.:format)       products#show 
       PATCH /catalog(.:format)       products#update 
       PUT /catalog(.:format)       products#update 
       DELETE /catalog(.:format)       products#destroy 

Warum haben sie keine :id s? Zum Beispiel, product#show sollte URI haben /products/:id(.:format), richtig?

Auch = link_to products_path(product), class: 'product' do führt mich zu http://localhost:3000/catalog.1

+1

Lesen Sie über [* Singular Resources *] (http://guides.rubyonrails.org/routing.html#singular-resources) – Pavan

Antwort