Will_paginate + RJS error

Hi there!
I need some help, I’m new to rjs + will_paginate and don’t know how
to
solve this problem.
The application apparently is working fine, the partial is rendered
by the javascript, the pagination works fine, but sometimes, when I
hit the next page number or " next >>", it reders the code below.
Im using rails 2.3.8, ruby 1.8.7. and will_paginate 2.3.15
Thanks!
try { Element.update(“search_professors”, "
Professors List
\n
\n\n\n\n\n\n \n Name Address Action \n
\n \n \n \n \n \n \n \n John \n \n \n \n
\n \n \n \n \n \n \n \n Carl \n \n \n \n \n
\n \n\n \n\n\n \n \n
\n
\n \n
\n\n
\n
\n
<< prev 1 2 next >>
\n
\n\n"); } catch (e) { alert(‘RJS error:\n\n’ + e.toString());
alert(‘Element.update(“search_professors”, "
Professors List
\n
\n\n\n\n\n\n \n Name Address Action \n
\n \n \n \n \n \n \n \n John \n \n \n \n
\n \n \n \n \n \n \n \n Carl \n \n \n \n \n
\n \n\n \n\n\n \n \n
\n
\n \n
\n\n
\n
\n
<< prev 1 2 next >>
\n
\n \n
\n\n
\n
\n
<< prev 1 2 next >>
\n
\n\n");’); throw e }
My Controller:
def search_professors
begin
@professors =
User.search_for(params[:search]).paginate(:all,:conditions =>
{:professor => true},:page => params[:page], :per_page => 8)
rescue => e
flash[:error] = e.to_s
@professors= User.search_for ‘*’
end
respond_to do |format|
format.html
format.js
end
end
The view:
<% tabnav :user do%>
<% form_remote_tag :url => ‘search_professors’ do %>
<%= text_field_tag :search, params[:search], :value => nil %>
<%= submit_tag “Go”, :name => nil , :disable_with => “Please
wait…”%>
<%end%>

<%= render :partial => "course/professors_list" %>

<% end %> The partial inside the view:

Professors List

<% form_tag('/user/email_professors', :method => :post) do%> <% if !removed_email_addr[email protected]? %> <% @professors.each do |professor| %> <% if !professor.nil? %> <% end %> <% end %>
Name Address Action
<%= check_box_tag "user_emails[]" , professor.email %> <%=image_tag professor.photo.url(:mini) %> <%= professor.spec.full_name %> <%= professor.address.address %>
<% else %>

No results!


<% end %> <% end %>
<%= will_paginate @professors %>
My JavaScript file search_professors.rjs page.replace_html :search_professors, :partial => "course/ professors_lista", :object => @users

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs