I am trying to create a todo list application for class, but I am having trouble listing each item in a list. Currently I find the current list being viewed by id, then I attempt to gather each each item in the list with: @items = @list.find_all_in_items(). When I try to load the page though I get the following exception: Unknown column ''items.list_id'' in ''where clause'': SELECT * FROM items WHERE items.list_id = 1 ORDER BY created_at DESC I have NO idea why Rails is looking for an the list_id in the items table. I made extra sure my models were correct, and each relationship looks fine. Any ideas? Cheers, Eric Czarny
Deirdre Saoirse Moen
2005-Oct-22 23:54 UTC
Re: has_many problems, can''t gather items in a todo list
On Oct 22, 2005, at 4:41 PM, Eric Czarny wrote:> I am trying to create a todo list application for class, but I am > having trouble listing each item in a list. Currently I find the > current list being viewed by id, then I attempt to gather each each > item in the list with: @items = @list.find_all_in_items(). When I > try to load the page though I get the following exception: > > Unknown column ''items.list_id'' in ''where clause'': SELECT * FROM > items WHERE items.list_id = 1 ORDER BY created_at DESC > > I have NO idea why Rails is looking for an the list_id in the items > table. I made extra sure my models were correct, and each > relationship looks fine. Any ideas?What do your relations look like? Also, what do the has_many and belongs_to relationships look like?