now ,this is _search_box.html.erb
<%= form_tag({:action => "search"}, {:method => "get"}) %>
<%= text_field_tag :q %>
<%= submit_tag "Buscarse" %>
<%= end %>
and this is search.thml.erb
<% render :partial => "search_box" %>
<% if @boxes %>
<p>Your search "<%= params[:q] %>" produced
<%= pluralize @boxes.size, "result" %>:</p>
<%= render(:partial => "boxes") %>
<% end %>
and this is what i get
syntax error, unexpected keyword_end
');@output_buffer.append= ( end );@output_buffer.to_s
You've got error in your _search_box
partial:
<%= form_tag({:action => "search"}, {:method => "get"}) do %> # and here too
<%= text_field_tag :q %>
<%= submit_tag "Buscarse" %>
<% end %> # remove = here
And you've missed do
also.
这样做,您在form_tag
中缺少do
<%= form_tag({:action => "search"}, {:method => "get"}) do %>
1<%= form_tag({:action => "search"}, {:method => "get"}) do %>
2<%= text_field_tag :q %>
3<%= submit_tag "Buscarse" %>
4<% end %>
5<%= render :partial => "search_box" %>
Line 1. you have missed do
Line 4. just <% end %>
Line 5. <% render :partial => "search_box" %>
to <%= render :partial => "search_box" %>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.