Reputation: 4346
I added resource :products, :path => 'catalog/'
to my routes.rb
, but my routs look like this:
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
Why do they have no :id
s? For example, product#show
should have URI /products/:id(.:format)
, right?
Also, = link_to products_path(product), class: 'product' do
leads me to http://localhost:3000/catalog.1
Upvotes: 0
Views: 110
Reputation: 2088
You should use resources :products
instead of resource :proucts
. For more info: https://cbabhusal.wordpress.com/2015/10/21/rails-routes-difference-between-resource-and-resources-in-routes-rb/
Upvotes: 3