Previously, in rails 2.3.8 i used the prototype-helpers link_to_remote
and form_remote_for
(amongst others).
These had the option :update
as follows:
link_to_remote "Add to cart",
:url => { :action => "add", :id => product.id },
:update => { :success => "cart", :failure => "error" }
(an example from the documentation). This example would, upon success update the html-element with class "cart", and upon failure the class "error".
Now i believe the modus operandi has changed, instead we write:
link_to "Add to cart", :url => {:action => "add", :id => product.id},
:remote => true
and there is no option to set :update
anymore.
Instead of a normal html, we now render javascript, like this (in jquery) :
$('.cart').replaceWith(<%= escape_javascript(render :partial => 'cart') %>)
but how do you handle an error situation? Do i handle it in my controller, and use seperate views?
It would seem useful to me to somehow be able to mimic the behaviour we had before. Any ideas?