render :update returns js wrapped in a HTML body
Hi.
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'...(?)
1. render :update do |page|
2. page.call :alert, "Im JS"
3. 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)
use the page/hi.js.rjs approach
1. :text => "alert('Im JS');", :content_type => "text/javascript"
1. respond_to do |format|
2. format.js
3. end
1. headers["Content-Type"] = "text/javascript; charset=utf-8
1. render :update, :layout => false, :content_type => "text/javascript" do
2. |page|
3. page.call :alert, "Im JS"
4. end
Thank you all in advance!
//Nicklas Ramhöj
Below is my environment:
2. Ruby version 1.8.6 (i686-darwin8.9.1)
3. RubyGems version 1.0.1
4. Rails version 2.0.2
5. Active Record version 2.0.2
6. Action Pack version 2.0.2
7. Active Resource version 2.0.2
8. Action Mailer version 2.0.2
9. Active Support version 2.0.2
10. Environment development
11. Database adapter mysql
12.
13. Mac OS X Leopard
14. Firefox 2.0.0.11
15. Safari 3.0.4
This thread can also be found at: http://www.ruby-forum.com/topic/138029#614027 and http://railsforum.com/viewtopic.php?pid=50104#p50104