Rails 3.0.5 broke my routes and kicked my dog
matthew.mceachen.us
matthew.mceachen.us
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.
namespace :products do
resources :comments do
get :like, :on => :member
end
endI agree that they screwed up re: backwards compatibility (in fact, michael koz said as much in the comments), so that's inexcusable.
However, the new change makes the URL name functions more consistent, because the new behavior for custom actions was always true for default actions
Before:
comment_like GET ...
products_comments GET ...
After: products_comment_like GET ...
products_comments GET ...