我有一個下拉的Ruby on Rails的下面,即:選定值頁面刷新後丟在Ruby on Rails的
<table>
<tr>
<td align="center">
<%= f.select(:Interest,options_from_collection_for_select(@students, "id", "student_mentor_subjects"), {},:id => "DDL_Students", :style => "width:160px;") %>
</td>
</tr>
</table>
而且學生是被填充f.select
和下面的表是架構學生表:
id | student_mentor_subjects
1 | ijk
2 | mno
3 | pqr
當我從上面f.select
選擇一個值,然後單擊搜索按鈕,然後頁面刷新,選擇的值丟失了,我怎麼能留住f.select
刷新頁面後選擇的值。 請幫助我,謝謝。
它給我一個錯誤「無法轉換成符號整數」 – user88
我曾經說過,只是一個例子:你有沒有貼什麼是存儲在@students或你的參數是什麼。 –
我編輯了我的帖子,親切地看到和吸取我 – user88