Forum: Ruby on Rails Ajax and Rails Problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
John D. (Guest)
on 2006-03-23 20:38
hi guys,

i am havin a problem displaying content of @wine from the search
action.. i get no errors i only get &nbsp where the results is when i
examine the html plz help
i posted my code

John









def search
@wines = Wine.find(:all)
@wine_pages, @wines = paginate :wines

 end



  def searchaction

@search=request.raw_post
@wines = Wine.find(:all,:conditions=>["name LIKE ?",@search])


end





action


<table align="LEFT" border="0" width="100%">
  <tr>
    <td><% @search %>

   <% @wines.each do |wine| %>
          </div></td>
      </tr>

      <tr>
        <td>
          <p align="center"></p>

            <table align="CENTER" cellpadding="8">
              <tr>
                <td width="50%"><div align="left">Name:
<%=wine.name%></div></td>
              </tr>
            </table>
            <% end %>


          <p align="center">&nbsp;</p>
          <p align="center">&nbsp;</p>          </td>
      </tr>
<tr>
  <td></td>
</tr>

    </table>
</td>
  </tr>
</table>




  <div align="center">
    <table align="CENTER" border="1" bordercolor="#FEFF34">
      <tr class="yellowbackcolor">
        <td colspan="5"><div align="center" class="style7">Enter The
item you wish to search for</div></td>
      </tr>
      <tr>
        <td><div align="center">Search For : <%= text_field_tag :search
%> <%= observe_field(:search, :frequency =>0.5,:url => { :action =>
:searchaction }, :update => :"results") %></div></td>

      </tr>
    </table>
  </div>

<span id="results" align="center">
  <table align="LEFT" border="0" width="100%">
    <tr>
      <td><table width="100%">
          <tr>
            <td><% if (@wines.empty?) then %>
                <table align="CENTER" width="700" border="0"
cellpadding="0" cellspacing="0">
                  <tr>
                    <td><h1 align="center"><span class="style1"> <span
class="style2">No Item was found matching your
cirteria</span></span></h1>
                        <h1 align="center">
                        <div align="center"><span class="style3">Search
Again..?</span><span class="style1"></div>
                  </tr>
                </table>
              <% else %>
                <% @wines.each do |wine| %>
                </div></td>
          </tr>
          <tr>
            <td><p align="center">&nbsp;</p>
                <table align="CENTER" cellpadding="8">
                  <tr>
                    <td width="50%"><div align="left">Name:
<%=wine.name%></div></td>
                  </tr>
                </table>
              <% end %>
                <% end %>
                <p align="center">&nbsp;</p>
              <p align="center">&nbsp;</p></td>
          </tr>
          <tr>
            <td><%= pagination_links(@wine_pages) %></td>
          </tr>
      </table></td>
    </tr>
  </table>
  </span>
This topic is locked and can not be replied to.