1
如何創建一個具有以下給出4個結果User.departments一個選擇框底部的添加自定義選項:基於以下Rails 3的選擇框幫手,如何在那些靜態
Department.title (Department.abbreviation)
Department.title (Department.abbreviation)
Department.title (Department.abbreviation)
Department.title (Department.abbreviation)
-----
Add New Department
模型:
User.department_id
Departments (id, title, abbreviation)
我無法弄清楚的是如何在添加新部門的底部添加兩個選項。
這是我到目前爲止有:
<%= collection_select(:user, :department_id, Department.where(:id => current_user.department_id), :id, :title, {:prompt => true}) %>
感謝