2011-12-14 19 views
0

データベース内の特定の行のステータスを取得して、rails(3)でビルドしたレポートのドロップダウンメニューの選択項目として使用できません。 。ドロップダウンボックスに選択項目が表示されない

データベース内
<% @report.each do |row| %> 
    <tr> 
    <td> 
     <%= select_tag :status, options_for_select(Distribution.select(:status).group(:status).order(:status).map {|d| [d.status, d.status]}), :selected => row.status %> 
    </td> 

1行が

を「フォローアップ」のステータスを持っていますが、ダウンボックスすべてのドロップは、私は、この間混乱していた

答えて

0

「配信」にデフォルト設定されています はここに関連する作品です構造体のform_forを指定します。 form_forで は、あなたが言うだろう:ここ

form_for @object... 
    <%=f.select options_for_select(), :selected => :object.field %> 

それは言うことで十分:

<% @report.each do |row| %> 
    <tr> 
    <td> 
     <%= select_tag :status, options_for_select(Distribution.select(:status).group(:status).order(:status).map {|d| [d.status, d.status]}, row.status) %> 
    </td> 
関連する問題