Plural version of the model detected, using singularized version. Override with --force-plural

what is the proper way to make this work? --force-plural doesn’t seem
to change the results. this only seems to happen when you choose
words that the plural and singular is the same word.

script/generate scaffold equipment name:string description:text
warning Plural version of the model detected, using singularized
version. Override with --force-plural.

results in the following error when you try to go to /equipment/new

ActionView::TemplateError (equipment_url failed to generate from
{:action=>“show”, :controller=>“equipment”} - you may have ambiguous
routes, or you may need to supply additional parameters for this
route. content_url has the following required parameters:
[“equipment”, :id] - are they all satisfied?) on line #3 of app/views/
equipment/new.html.erb:
1:

New equipment


2:
3: <% form_for(@equipment) do |f| %>
4: <%= f.error_messages %>
5:
6:
(eval):16:in `equipment_path'
app/views/equipment/new.html.erb:3
app/controllers/equipment_controller.rb:29:in `new'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'

The long answer is to edit the file “YOUR_APPLICATION/config/
initializers/inflections.rb” to specify what you want to use for the
singular / plural pair.

The short answer is choose model names that have unique singular /
plural forms.

2009/10/2 Boar [email protected]:

what is the proper way to make this work? Â --force-plural doesn’t seem
to change the results. Â this only seems to happen when you choose
words that the plural and singular is the same word.

script/generate scaffold equipment name:string description:text
  warning  Plural version of the model detected, using singularized
version. Â Override with --force-plural.

Using a word like Equipment for a model seems like a bad idea, and is
the root cause of your problem. One cannot have an equipment (in the
real world I mean). If a row in the table represents one piece of
equipment then you could call it Unit or EquipmentItem or something.
If it actually represents a collection of items then call it an
EquipmentSet or other word that indicates that it is a collection.
You can tell that equipment is not a good word from the fact I do not
know whether it represents a collection or a unit.

Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs