All pastes #747593 Raw Edit

holy

public ruby v1 · immutable
·published 2007-10-24 05:02 UTC
rendered paste body
search index page:<%= form_tag nil, { :id => 'search_form'} %>Search Tutorials<br/><%= text_field 'tutorial', 'title' %><%= end_form_tag %><div id="tutorial"></div><%= observe_form :search_form, :frequency => 0.5, :update => 'tutorial', :url => { :action => 'search_ajax' }%>Search Controller:class SearchController < ApplicationControllerdef indexenddef search_ajax  @tutorials = Tutorial.find(:all, :conditions => ["title LIKE ?", "%#{params[:tutorial][:title]}%"])  render :layout => false  end endSearch AJAX page:<% for tutorial in @tutorials %><div> <%= link_to tutorial.title, :controller => 'tutorial', :action => "show", :id => tutorial.id %></div> <div><small>posted in: <%= tutorial.category %> by <%= tutorial.username %> on <%= tutorial.date %> </small></div><% end %>