close
<%= f.input :brand_id, :collection => @brands, :include_blank => false, :label => "品牌" %>
使用 :collection ,就會自動切換成 select tag ,不用再加 :as => :select 啦。
但是預設會生出一個空白選項,你可以用 :prompt => "預設文字" 設定它,或是像我一樣使用 :include_blank => false 移除這個空白選項。
文章標籤
全站熱搜