Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

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

#4408

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

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

State: invalid
Milestone: none
Assigned to: Ryan Bigg Ryan Bigg
Importance: Low

Activity

  1. Erik St. Martin
    Erik St. Martin
    • 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

    April 16th, 2010 @ 12:57 AM

  2. Erik St. Martin
    Erik St. Martin
    • Assigned user set to Ryan Bigg

    please mark as invalid

    April 16th, 2010 @ 01:02 AM

  3. Ryan Bigg
    Ryan Bigg
    • Tag changed from helpers, invalid, paths, resource to helpers, paths, resource
    • State changed from new to invalid

    April 16th, 2010 @ 01:23 AM