我想替换此行代码:
来自:
f.collection_select(:status, Status.all, :id, :name
收件人:
f.collection_select(:status, [{id: 1, name: "status1"}, {id: 2, name: "status2"}], :id, :name
但是我得到了错误:
{:id => 1,:name =>“ status1”}:哈希的未定义方法`name'
答案 0 :(得分:0)
<%= f.select(:status, [['status1', 1], ['status1', 2]] ) %>