我有一个表单和一个按钮:
= button_tag( "×" , type: "button", html: {class: "close", aria-hidden: "true"}, data: {dismiss: "alert"} )
它从 twitter bootstrap [ http://getbootstrap.com/components/#alerts ] 转换为 rails:
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
但是 rails 变体出现错误:
SyntaxError in Search#get_search
Showing /.../app/views/search/new.html.slim where line #58 raised:
/.../app/views/search/new.html.slim:58: syntax error, unexpected tLABEL
...: {class: "close", aria-hidden: true}, data: {dismiss: "ale...
... ^
/.../app/views/search/new.html.slim:58: syntax error, unexpected ')', expecting keyword_end
... {dismiss: "alert"} )))).to_s));
... ^
有问题aria-hidden: "true"
或dismiss: "alert"
有问题
为什么会这样?我使用了不同的变体来抱怨 [ http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-button_tag ]:
button_tag(content_or_options = nil, options = nil, &block)