This project is archived and is in readonly mode.

#4408 ✓invalid
Caleb Perkins

"resource"_path and "resource"_url helpers generate incorrect URLs

Reported by Caleb Perkins | April 15th, 2010 @ 11:34 PM

In the Rails 3 beta, with an AuctionsController and an Auction model.....

routes.rb

Panda::Application.routes.draw do |map|
resources :auctions end

show.html.erb

<%= link_to "Test", auctions_path(Auction.first) %>

The output of the test link is "http://localhost:3000/auctions.1" which is an invalid link. (The correct output is "http://localhost:3000/auctions/1" with a slash.)

Comments and changes to this ticket

  • Erik St. Martin

    Erik St. Martin April 16th, 2010 @ 12:57 AM

    • Tag changed from helpers, paths, resource to helpers, invalid, paths, resource

    your usage of the helpers are incorrect

    auctions_path links to the index of all auctions
    auction_path(Auction.first) would link to a specific auction

    link_to is also smart about models so you could use link_to "Test", auction

  • Erik St. Martin

    Erik St. Martin April 16th, 2010 @ 01:02 AM

    • Assigned user set to “Ryan Bigg”

    please mark as invalid

  • Ryan Bigg

    Ryan Bigg April 16th, 2010 @ 01:23 AM

    • Tag changed from helpers, invalid, paths, resource to helpers, paths, resource
    • State changed from “new” to “invalid”

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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages