0
路径菜单从此documentation我看到,我可以使用这样的选择方法:下拉的使用Rails“选择”方法
select("post", "person_id", Person.all.collect {|p| [ p.name, p.id ] }, { :include_blank => true })
和它产生:
<select name="post[person_id]">
<option value=""></option>
<option value="1" selected="selected">David</option>
<option value="2">Sam</option>
<option value="3">Tobias</option>
</select>
会是什么我选择方法看起来像是如果我有这样一个数组:
[["Add Post", new_post_path],["Add Document", new_document_path],["Add Coupon", new_coupon_path]]
而我想这样的HTML:
<select name="post[person_id]">
<option value="new_post_path" selected="selected">Add Post</option>
<option value="new_document_path">Add Document</option>
<option value="new_coupon_path">Add Coupon</option>
</select>