2016-09-22 58 views
0
Rails 5.0.0.1 
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15] 

我正在使用Rails 5,當我嘗試設置文本區域的佔位符時,它輸出散列值而不是設置佔位符的值。Rails中的文本區域標籤佔位符輸出原始值作爲文本區域值

<%= form_tag(new_project_note_path, method: 'POST') do %> 
    <%= text_area_tag :content, placeholder: "Your note..." %> 
<% end %> 

enter image description here

+0

使用'<%= text_area_tag:內容, 「你記...」 %>' – Emu

回答

2

docstext_area_tag(name, content = nil, options = {})

第二個選項是內容。如果您不想傳遞任何內容,請將其設爲零。

試試這個。

<%= text_area_tag :content, :nil, placeholder: "Your note..." %> 

希望這會有所幫助。

+0

根據目前的文檔,它的'nil'而不是' :無'你應該通過什麼作爲仲裁論點。 – mutil

1

<%= text_area_tag :post, :"", placeholder: "Your note..."%>

啤酒花這有助於...