Search code examples
ruby-on-railsresourcesmodelpluralsingular

Handle Ruby on Rails resource when the singular is also plural?


Whats the best way to handle a singular resource, that itself is plural.

For example a "settings page", that displays a selection of different settings. As I am displaying a single "Settings" instance, I would expect to use the show action, but would want to have "settings" not "setting" in the url.

If I called the resource "settings_group" it would solve the problem, but that name is far from catchy, and not an ideal solution.

Thanks


Solution

  • A quick way to achieve this is to write it yourself:

    resources :settings, :except => :show
    match "settings/:id" => "settings#show", :as => :setting