This project is archived and is in readonly mode.

#1124 ✓invalid
Conrad Taylor

RJS generating raw javascript when using observe_field

Reported by Conrad Taylor | September 27th, 2008 @ 01:22 PM | in 2.x

Hi, I'm in the process of structuring a live search within an application. Thus, I have the following so far:

  • search.html.erb - This file contains the entire template for the page. The relevant pieces is as follows:

<%= text_field_tag 'search_text' %>

<%= observe_field( 'search_text',

                                :frequency => 0.5,
                    :with => 'search_text',
                                :url => { :action => :search }) %>

  • UpdateController#search - The relevant pieces is as follows:

def search

@episodes = Episode.activated.search( params[:search_text] )

render :update do | page |
  page[:search_hits].replace_html :partial => 'episode', :collection => @episodes, :locals => { :display => "thumb" }
end

end

Now, when render is invoked in the search action above, I'm getting the raw Javascript code returned to the browser in a try-catch block instead of the search_hits div being updated. Lastly, I'm using Rails 2.1.1 on Mac OS X 10.5.5.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Tags

Pages