

Rails 3.0.5 broke my routes and kicked my dog - mceachen
http://matthew.mceachen.us/blog/rails-3-0-5-broke-my-routes-and-kicked-my-dog-1076.html

======
ryanbigg
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
Thanks for sharing about member blocks. I'll update our routes to use them.

------
YuriNiyazov
Hi Matt

I 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 ...

------
jrockway
Does Rails not have a release candidate process? If not, that's odd. If so,
you should test the release candidates, that's what they're for!

~~~
riffraff
it does, and someone pointed out exactly this in the comments, but I guess
some things slip through

~~~
epochwolf
It slipped through because the author was using an unsupported nesting. See:
<http://news.ycombinator.com/item?id=2281328>

------
catch23
I've been using namespaces with path methods like namespace_resource_path in
3.0.1 without issues... I think they just made the rules for calling a route
more strict since without the namespace prepended on the path method could
lead to confusion.

------
waratuman
Um... fix it and keep moving. Is this really worth a blog post?

~~~
albemuth
Maybe there's a chance that someone on the internet will have the same
problem?

