From what I'm learned the below is suppose to return "alert('Im JS');"
to the javascriptGenerator that's suppose to make the page scream 'Im
JS'...(?)
render :update do |page|
page.call :alert, "Im JS"
end
In Rails 1.2.3 it works perfectly.
BUT in Rails 2.0.2 it returns the js neatly wrapped in a full HTML-body,
and the browser shows me nada... (!)
Please help me here, I've tried everything I can think of for hours now!
Random things I've tryed (not in any order, and just glimpses)
1. use the page/hi.js.rjs
2. use the render :text => "alert('Im JS');", :content_type =>
"text/javascript"
3. respond_to do |format|
format.js
end
4. headers["Content-Type"] = "text/javascript; charset=utf-8
Ruby version 1.8.6 (i686-darwin8.9.1)
RubyGems version 1.0.1
Rails version 2.0.2
Active Record version 2.0.2
Action Pack version 2.0.2
Active Resource version 2.0.2
Action Mailer version 2.0.2
Active Support version 2.0.2
Environment development
Database adapter mysql
Is rails being dumb and adding a layout ? (in which case
adding :layout => false should help)
My guess once too, but 1. it's not my layout that's being rendered
around the JS, but just a <html><head><title></title></head><body>my
code</body></html> and 2 I've tried:
render :update, :layout => false, :content_type => "text/javascript" do
page>
page.call :alert, "Im JS"
end
(sorry for not mentioned that above!)
Thanks for your help, please let me know if you can think of anything
else...