Topic: Calling on a second model within a controller
Hi, I'm new to rails and apologize if this is trivial; however I cannot find a solution in the book I have...
On to the problem, I would like to display a list of categories to pick one from (say in a drop down menu, but that's not the issue), the categories belong to a user and the item they are attached to holds a category id in the database. Anyway, I wrote something like this hoping to get access to the categories, but it doesn't seem to be returning anything, and it isn't throwing any errors.
@categories = Category.find(:all, :conditions =>
[ "user_id = ?", session[:id] ])
That line is within a different controller (not the category one) I have
model :user, :category
at the top, and am sure that the session id is set. When I try to print to_s on @categories in the view nothing comes out, so I believe nothing is being set. Can someone shed some light on this for me? Thanks so much.