Devin
Devin

Reputation: 911

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_details'}, :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.

Upvotes: 0

Views: 818

Answers (1)

Jasdeep Singh
Jasdeep Singh

Reputation: 3326

please include csrf_meta_tag helper in the header..

Upvotes: 1

Related Questions