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. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 11 August 2011 02:49, tmountain <tinymountain-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Good advice. I will go this route (pun pun). Thanks! On Aug 11, 3:52 am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 11 August 2011 02:49, tmountain <tinymount...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.