简体   繁体   English

Ruby on Rails忽略了我的form_tag

[英]ruby on rails ignores my form_tag

I have written in my index.html.erb the following lines 我在index.html.erb中写了以下几行

<% form_tag illnesses_path, :method =>'get' do %>
  <p>
     <%=  text_field_tag :search, params[:search] %>
     <%=  submit_tag "Search", :name => nil %>
  </p>
<% end %>

expecting that it will write a form element but rails completrly neglected those line. 期望它会写一个表单元素,但Rails完全忽略了这些行。
when I wrote 当我写

 <p>
     <%=  text_field_tag :search, params[:search] %>
     <%=  submit_tag "Search", :name => nil %>
  </p>

the items apeared (but no form element). 取消的项目(但没有表单元素)。 Why was the form element neglected 为什么忽略表单元素

Change <% form_tag illnesses_path, :method =>'get' do %> 更改<% form_tag illnesses_path, :method =>'get' do %>

to

<%= form_tag illnesses_path, :method =>'get' do %> . <%= form_tag illnesses_path, :method =>'get' do %>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM