Lurlay, Patrick
2006-Apr-28 20:40 UTC
[Rails] undefined method `name'' for #<Category:0x3820f70>
All, I am having a bit of trouble with the error. I hava a product and category table and wanting to display the categories in a drop down list. Below is the error I get. Any suggestion on how I can fix this. undefined method `name'' for #<Category:0x3652448> 9: <select name="product[category_id]"> 10: <% @categories.each do |category| %> 11: <option value="<%= category.id %>"> 12: <%= category.name %> 13: </option> 14: <% end %> 15: </select> Thanks Patrick
Charlie Bowman
2006-Apr-28 20:47 UTC
[Rails] undefined method `name'' for #<Category:0x3820f70>
This may sound silly, but do you have a field named name in your category table? On Fri, 2006-04-28 at 13:38 -0700, Lurlay, Patrick wrote:> All, > I am having a bit of trouble with the error. I hava a product and > category table and wanting to display the categories in a drop down > list. Below is the error I get. Any suggestion on how I can fix this. > > undefined method `name'' for #<Category:0x3652448> > > 9: <select name="product[category_id]"> > 10: <% @categories.each do |category| %> > 11: <option value="<%= category.id %>"> > 12: <%= category.name %> > 13: </option> > 14: <% end %> > 15: </select> > > Thanks > > Patrick > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060428/8d28e991/attachment.html