## HELPER CODE def pagination_links_remote(paginator) page_options = {:window_size => 1} pagination_links_each(paginator, page_options) do |n| options = { :url => {:action => 'list', :params => @params.merge({:page => n})}, :update => 'table', :before => "Element.show('spinner')", :success => "Element.hide('spinner')" } html_options = {:href => url_for(:action => 'find', :params => @params.merge({:page => n}))} link_to_remote(n.to_s, options, html_options) end ### CONTROLLER def find unless @params[:search].nil? query = "select distinct a.id, a.title from yourimages a, taggings b, tags c where (c.id = b.tag_id and b.taggable_id = a.id and c.name like '%"+params[:search].downcase+"%') or a.title like '%"+params[:search].downcase+"%' order by created_at desc" @search_pages, @tags = paginate_by_sql Yourimage, query, 10 @total = @tags.size else end if request.xml_http_request? render :partial => "ilist", :layout => false end end ### VIEW
No items found...
<% else %><% unless @params[:search].nil? %><%= pagination_links_remote @search_pages %><%else%><%end%>
<% @tags.each do |t| %> <%= link_to t.title, {:action => 'show', :id => t} -%>