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.

Unable to handle Urls for not-pluralizeable Resources

#1130

If the name of a Resource is the same as for singular and plural rails url-helpers seem to have trouble generating the appropriate urls.

I found some old (Trac) Tickets, but there never seems to have been a sollution.

Simple Example "News"


news_path(news) # works fine
news_path # does not work, singular helper but we want it to be index

simple fix for that would be


def news_path(news = nil)
  return news_index_path if news.nil? || news.new_record?
  super
end

If that sounds like a proper way to be added to the core i'd take this as a chance to submit my first patch.

Reported by Benjamin Hüttinger · September 28th, 2008 @ 03:48 PM

State: resolved
Milestone: 3.x
Assigned to: Mikel Lindsaar Mikel Lindsaar
Importance: none

Activity

  1. Pratik
    Pratik
    • State changed from new to incomplete

    Hey,

    Could you please submit a failing test case ?

    Thanks.

    January 18th, 2009 @ 05:56 AM

  2. Ryan Bigg
    Ryan Bigg
    • Assigned user set to Mikel Lindsaar

    Solution: use route names that can be properly pluralized.

    April 10th, 2010 @ 10:56 AM

  3. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  4. Mike Riley
    Mike Riley
    • State changed from incomplete to resolved
    • Importance changed from to

    Hello,

    Due to the date since the last update and because it is incomplete, I am going to close this ticket. If you can provide a failing test case we can investigate this further.

    Mike Riley

    July 29th, 2010 @ 05:18 PM