On 11 August 2011 02:49, tmountain <[email protected]> wrote:
> 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 %> <br>
>
> 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.

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

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to