3 ms·
Rails 3.0.5 did nothing wrong. The correct code for this: namespace :products do resources :comments do member do get :like
by ryanbigg 16y ago
Rails 3.0.5 did nothing wrong.
The correct code for this:
namespace :products do
resources :comments do
member do
get :like
end
end
end
Using a `get` without a `member` block leads to the misbehaviour as seen here, and it's also non-standard.
When defining additional actions for a resource one should always use a `member` block for actions that work on a single object or `collection` for those actions that work on many.
- mceachen 16y agoThanks for sharing about member blocks. I'll update our routes to use them.
- JonnieCache 16y agoWith a single member route it's more concisely written like this: namespace :products do resources :comments do get :like, :on => :member end end
- deleted 16y ago[deleted]