2016-09-22 48 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..."%>

啤酒花这有助于...