Joel's Blog

I have no idea what im doing


Im not sure if this is a rails version thing, but I have a 1-many relationship and the scaffolding that comes with rails doesnt seem to build a dropdown for the child to select the parent in the new/modify. So I want to do this and I look in chapter 22 of my agile web development with rails book, and it shows: %users = User.find(:all, :order => "name") form.collection_select(:name,@users,:id,:name) this fails because form is nil, looking at the rest of my code I dont see form explicitly referenced, so I remove form and I get a wrong number of arguments for select. Finally I googled the web and I found <%= collection_select 'user', 'group_id', Group.find_all, 'id', 'name' %> this seems to work fine.

Comments: Post a Comment

<< Home


This page is powered by Blogger. Isn't yours?