Rails 3 Collection for builder
I'm trying to build a custom drop down list for an item in my form. I've created an item partial that is used for each item and call it in my form. The code in my form is...
<%= render 'form_item', :f => f, :title => "Availability", :group => :status, :item => :available, :view => "select_list",
:return_field => {}, :list => ["Available", "Not-Available"], :prompt => 'Please select' %>
My builder for this view looks like this...
<% elsif view == "select_list" %>
<%= builder.select item, list, {}, { :index => nil, :include_blank => prompt} %>
When I execute the code Selecting eit开发者_Go百科her Available or Not-Available I receive a 500 Internal Server Error. When I check my log it reads:
2011-06-13 10:06:04 FATAL --
TypeError (expected Array (got Hash) for param `status_attributes'):
Any ideas around this?
Without seeing more of the code it is hard to see the context in which these snippets exist. However, here is an idea of where to look.
Is there an []
at the end of the HTML name for the select box. I am assuming that you are listing them? Maybe changing to :item => 'available[]'
would allow for multiple select boxes.
精彩评论