Rails 3 remote link displays RJS code on page
I have a Rails 3 app that uses a remote/AJAX link to update a partial on the page. In my view, I have the following:
<%= link_to 'link text', {:action => 'update_detail开发者_开发知识库s'}, :remote => true %>
That action in my controller has the following:
render(:update) do |page|
page.replace_html 'details', :partial => 'details'
end
Instead of updating with the HTML in the 'details' partial it redirects to a page that prints the RJS code for doing that:
try {
Element.update("details", "\nDetails\n\n");
} catch (e) { alert('RJS error:\n\n' + e.toString()); alert('Element.update(\"details\", \"\nDetails\n\n\");'); throw e }
I don't get a Javascript error of any kind and I'm including all the necessary Javascript files, including Prototype.
please include csrf_meta_tag helper in the header..
精彩评论