Inflector Issue?

Hi, just stubbing out an app with Rails3, and I’ve run into a snag
trying to generate a scaffold for Equipment. Namely, the following
happens:

$ rails generate scaffold Equipment name:string

$ cat app/views/home/index.html.erb
<%= link_to “Equipment”, equipment_path %>

Hitting the index gives this error:

No route matches {:action=>“show”, :controller=>“equipment”}

I’ve looked around the web a bit, and tried playing with config/
initializers/inflections.rb (specifying that equipment is uncoutable),
but that didn’t help. Also, checking on the rails console shows that
equipment already pluralizes to equipment, so I’m not sure what the
exact issue is.

On 11 August 2011 02:49, tmountain [email protected] wrote:

No route matches {:action=>“show”, :controller=>“equipment”}

I’ve looked around the web a bit, and tried playing with config/
initializers/inflections.rb (specifying that equipment is uncoutable),
but that didn’t help. Also, checking on the rails console shows that
equipment already pluralizes to equipment, so I’m not sure what the
exact issue is.

The best solution may be to use a better class name. After all it
makes no sense to talk about “an equipment” for example. Use
something like EquipmentItem with table name equipment_items or even
just Item or Unit or anything else you fancy that has a singular and
plural. Then you will remove the problem and make the code more
readable.

Which reads best
Workshop has_many equipment or Workshop has_many equipment_items

Colin

Good advice. I will go this route (pun pun). Thanks!