Rails: Processing of forests, such as "Sheep", which have the same plural and singular

I want to create a CommunicationMeans model (or, alternatively, MeansOfCommunication). However, this is the only and plural form of the term. I ran this:

$ rails g scaffold CommunicationMeans

He created a model called CommunicationMean and a controller named CommunicationMeansController. I need a model, which can also be called CommunicationMeans. I vaguely remember an example in some documentation using the Sheep model, but what is the “right” way to handle this situation? Thank.

+5
source share
2 answers

config/initializers/inflections.rb "" .

: , , , :

ActiveSupport::Inflector.inflections do |inflect|
   inflect.uncountable 'CommunicationMeans'
end
+5

, config/initializers/inflections.rb - ..

Inflector.inflections do |inflect|
    inflect.plural 'sheep', 'sheep'
end
0

All Articles