Rails RJS template displays code instead of the html page
- by Anand
After having Googled and hurting my brain for hours on this, I finally decided to post this question. Here's the code...
view1.html.erb
--------------
<%=link_to_remote_redbox "Link", :url => {:action => :action1, :id => @some.id}
some_controller.rb
------------------
def action1
render :layout => false
end
def action2
do some processing
end
action1.html.erb
--------------------
<form onsubmit="new Ajax.Request('/some_controller/action2', {asynchronous:true, evalScripts:true, onComplete:function(request){RedBox.close(); return false;}, parameters:Form.serialize(this)}); return false;}" method="post" action="/some_controller/action2">
<input type=text name='username'>
<input type='submit' value='submit'>
</form>
action2.rjs
-----------
page.replace_html("some_div", (render(:partial => "some_partial")))
with that code in place when action2.rjs kicks in it should display the html page instead I am getting this
Element.update("some_div", "<style type=\"text/css\">\n\n..............
As suggested on other posts I read, they say its caused because of the ":update = some_div" in the link_to_remote_redbox function but clearly my code doesn't have that.
Help is always appreciated.
Many Thanks