我正在尝试填充一个集合(@displayable_collection)以在我的表单中进行选择
(这是最终将进入@displayable_collection 的简化版本
这是我的代码......但它不工作......我做错了什么?
controller do
before_filter :populate_collection, :only => [:new, :edit]
private
def populate_collection
@displayable_collection = ArtItem.all.map{ |item| [item.to_s, "#{item.class}_#{item.id}"]}
end
end
form do |f|
f.inputs 'Details' do
f.input :project
f.input :name
end
f.inputs 'Display Items' do
f.has_many :display_items do |item|
item.input :displayable_combined_fields, :collection => @displayable_collection
item.input :location, :input_html => {:selected => location.id}
item.input :height
item.input :width
item.input :depth
end
end
f.actions
end