i am kind of desparated i try with options_from_collection_for_select to get option values, but it says You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occured while evaluating nil.inject but @customers is not empty -> def get_customer @customers=Customer.find_all end i have tested it and also the attributes "id" and "name" are existing!! <h1> xy </h1> <%=start_form_tag :action => 'get_article' %> <select name=xy> <%= options_from_collection_for_select (@customers, "id", "name") %> </select> <%= submit_tag "Get" %> <%= end_form_tag %>
on 2006-01-04 00:20
on 2006-01-04 02:53
Assuming the rhtml code you pasted is from get_customer.rhtml, I don't see anything wrong with the code. I personally use 'select()' more often than 'options_from_etc_etc', but in this case you're not working with any objects that exist yet, but rather passing the selection as a parameter to a different action. What you've got should be fine. What do you get when you put <%= debug(@customers) %> right under the <h1> tag in your RHTML source?