This project is archived and is in readonly mode.

#1130 ✓resolved
Benjamin Hüttinger

Unable to handle Urls for not-pluralizeable Resources

Reported by Benjamin Hüttinger | September 28th, 2008 @ 03:48 PM | in 3.x

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.

Comments and changes to this ticket

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>

Tags

Pages