2

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

dangerousdave
  • 6,331
  • 8
  • 45
  • 62

2 Answers2

1

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

resources :settings, :except => :show
match "settings/:id" => "settings#show", :as => :setting
apneadiving
  • 114,565
  • 26
  • 219
  • 213
0

In Rails 2.x, you can do

resource :setting, :as => 'settings'

The generated URLs will use setting, though.

asymmetric
  • 3,800
  • 3
  • 34
  • 52