I am developing a small blog with a cool feature to edit articles in the
page through ajax.
So I made my Raisl3 app load jQuery and opened AWDWR3 to learn whether
anything had changed.
So I create an RJS template: edit.js.rjs with:
Obviously when I clicked my edit button that triggers the ajax
replacement of the article by an editable form it failed.
My first surprise was to be greeted by an “Element.update is not a
function” error. I then realized that I cannot use page.replace_html
which is reserved to Prototype.
No big deal I’ll create an edit.js.erb file with:
$("#article_<%= @article.id %>").update("<%=
The application gets hit, but nothing else happens on the client side.
Anyway, I’m not sure I understand correctly all this ajax stuff in
Isn’t it an issue to write js code in edit.js.rjs? Since it is dynamic
What’s the authoritative way of doing jQuery + Rails3 + Unobstrusive +
Clean + etc?
AWDWR doesn’t teach good practices in this point of view.