2

I am developing a Rails app which should rely on existing database. There are a couple of table names there which are the always plural words, like "Series".

Application is not working correctly with the models associated with them. How would you propose to deal with it - is there any solution without changing the naming?

Thanks in advance!

lyuba
  • 6,250
  • 7
  • 27
  • 37

1 Answers1

5

It sounds like you need to tell Rails that "Series" is uncountable - that is, that it shouldn't try inflecting it for singular/plural. To do this, add the line inflect.uncountable 'series' to your config/initializers/inflections.rb file.

Curiously, however, "series" appears to be uncountable by default; did you just pick it as an example out of a number of similar names?

Chowlett
  • 45,935
  • 20
  • 116
  • 150
  • wow, that's interesting. My problem, however, is still present, since when I get to the http://localhost:3000/series it says `uninitialized constant SeriesController` In the routes I have: `resources :series` – lyuba Jul 12 '11 at 12:37
  • 1
    And do you have a `SeriesController`? That is, do you have a file `app\controllers\series_controller.rb` which defines `class SeriesController < ApplicationController`? – Chowlett Jul 12 '11 at 12:48
  • Just spotted the bug - controller was called series.rb rather than series_controller.rb. Probably I made this mistake in a round of renaming because of the uncountable nouns problem, which is also solved now. Still don't understand the coincidence of having even two uncountable nouns of the models just in one project :) Thanks for your help! – lyuba Jul 12 '11 at 13:21