2014-02-05 27 views
0
<%= f.select(:id, User.all.collect{|p| [p.name, p.id]}, {}, html_options = { :style=>'border-radius: 0px;' }) %> 

我正在使用上述語句來獲取用戶填充選擇框。我想要包括一個空白或者最好是默認情況下選擇的提示框。我使用的是Rails 3.2,但我還沒有找到適合我的解決方案。任何意見是極大的讚賞!提示/空白選項的選擇瓦特/收藏

回答

1

這應該工作(更新):

<%= f.select(:id, User.all.collect{|p| [p.name, p.id]}, { include_blank: 'Prompt text...'}, html_options: { :style=>'border-radius: 0px;' }) %> 
+0

可惜不是:( – opticon

+0

這是什麼缺少你得到的選擇選項的提示框,你不 – vee

+0

拋出一個語法錯誤:??/ .. ./app/views/postings/edit.html.erb:56:語法錯誤,意外的')',期待tASSOC ... style =>'border-radius:0px;' })); @ output_buffer.safe_concat ... – opticon