Boar
2009-Oct-02 22:31 UTC
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: <h1>New equipment</h1> 2: 3: <% form_for(@equipment) do |f| %> 4: <%= f.error_messages %> 5: 6: <p> (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''
Rick
2009-Oct-03 01:50 UTC
Re: Plural version of the model detected, using singularized version. Override with --force-plural.
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. On Oct 2, 6:31 pm, Boar <dpwildb...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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: <h1>New equipment</h1> > 2: > 3: <% form_for(@equipment) do |f| %> > 4: <%= f.error_messages %> > 5: > 6: <p> > > (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''
Colin Law
2009-Oct-03 08:21 UTC
Re: Plural version of the model detected, using singularized version. Override with --force-plural.
2009/10/2 Boar <dpwildboar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > > 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