Forum: Ruby on Rails Funky RJS error - Live Search

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.
jko170 (Guest)
on 2007-03-15 10:28
(Received via mailing list)
Everything works like I want it to, except I get this weird error text
that is inserted into the page (but not the html). Here is my
controller:

def search
    if request.xhr?
      if params[:search_text].strip.length > 0
        terms = params[:search_text]
        @results = User.find(
          :all,
          :conditions => [ 'LOWER(first_name) LIKE ? OR
LOWER(last_name) LIKE ?',
           "%#{terms.downcase}%", "%#{terms.downcase}%" ],
          :limit => 10)
        render :update do |page|
          page[:results].replace_html :partial => "search"
          page[:recent].hide
        end
      elsif params[:search_text].strip.length == 0
        render :update do |page|
          page[:recent].show
        end
      end
    else
      redirect_to users_path
    end
  end

Here is the error:
try { $("recent").show(); } catch (e) { alert('RJS error:\n\n' +
e.toString()); alert('$(\"recent\").show();'); throw e }

I'm guessing I'm screwing up the rjs code. When the live search input
field is in use, I want to hide the 'recent' div. When it is Not in
use, I want to show the 'recent' div. The error text ends up above the
'recent' div. Am I doing this the wrong way?
This topic is locked and can not be replied to.