我有这个在application_helper.rb
,因为我用的是相同的过滤器形式的一些车型。
def filter_form(path, filter_options, button)
form_tag(path, remote: true, method: "get") do
label_tag(:filter, "Filter by")
select_tag(:filter_type, options_for_select(filter_options))
"<span>for:</span>".html_safe
text_field_tag(:filter)
button_tag(:submit, "Submit") if button == true
end
end
而在我的例如用户文章中,我有
<%= filter_form(articles_path, @filter_options, false) %>
然而,在代码我可以看到它仅产生<form action="/articles" accept-charset="UTF-8" data-remote="true" method="get"><input name="utf8" value="✓" type="hidden"></form>
标记这是所有微细且良好的,但没有表单元素的显示。 这是为什么?