lyuba
lyuba

Reputation: 6390

What if the model in the ActiveRecord is an always plural word?

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!

Upvotes: 2

Views: 1308

Answers (1)

Chowlett
Chowlett

Reputation: 46667

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?

Upvotes: 5

Related Questions