This project is archived and is in readonly mode.

#6224 ✓stale
Hiram Nascimento

Unclear route error thrown when an invalid object is passed to a "_path" method

Reported by Hiram Nascimento | December 26th, 2010 @ 04:54 PM

Assuming that we have the following resources at config/routes.rb:

... resources :users do
reousrces :posts end

So, somewhere in a view, I would use the link_to method:

link_to 'Go!', user_posts_path(@anything)

Assuming that the @anything is invalid, Rails throws a very unclear error about the route:

"ActionController::RoutingError in Welcome#index"

In my opinion, it should first throw an error saying that the passed parameter is not valid, because the route exists, but only the parameter is invalid.

I can provide further details for you to reproduce this scenario.

Comments and changes to this ticket

  • Andrew White

    Andrew White February 9th, 2011 @ 04:28 AM

    • State changed from “new” to “needs-more-info”
    • Importance changed from “” to “Low”

    What do you mean by invalid? Do you mean that it's an instance of User but @user.valid? is false? Can you please post a backtrace, thanks.

  • Andrew White

    Andrew White March 6th, 2011 @ 04:28 PM

    • State changed from “needs-more-info” to “stale”

    Marking as stale as no feedback for a month

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>