Ruby on Rails Sunday, October 31, 2010

I have a form_tag that works fine using html, but when I use ajax with
the remote => true I am getting this error:-
My terminal log shows:-
Started GET "/" for 127.0.0.1 at 2010-11-01 01:19:49 +0000
Processing by HomepagesController#index as HTML
Homepage Load (0.6ms) SELECT "homepages".* FROM "homepages"
Rendered homepages/index.html.erb within layouts/application (23.0ms)
Completed 200 OK in 40ms (Views: 27.3ms | ActiveRecord: 0.6ms)
Error during failsafe response: incompatible encoding regexp match
(UTF-8 regexp with ASCII-8BIT string)
***** then a load of cleaner.rb stuff
then:-
Started GET "/homepages?utf8=%E2%9C%93&search=hom" for 127.0.0.1 at
2010-11-01 01:19:56 +0000
Processing by HomepagesController#index as JS
Parameters: {"utf8"=>"✓", "search"=>"hom"}
Homepage Load (0.5ms) SELECT "homepages".* FROM "homepages" WHERE
(section LIKE '%hom%')
Rendered homepages/index.js.erb (2.9ms)
Completed in 19ms

In my index.js.erb I have:-
$("testsearch").update("<%= escape_javascript(render(@homepages))%>");

and in my Controller I have:-
def index
@homepages = Homepage.search(params[:search])
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @homepages }
format.js { render :layout => false }
end
in my view I have:-
<div id = "testsearch"> which prints @homepages using a table using <%
@homepages.each do |homepage| %> which is not being updated.

Anyone have any ideas as to why I get this error.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment