Topic: automatic AJAX

Hello,
I'm new at RoR development. I have been using ZK and Vaadin view Java frameworks to develop Single Page Interfaces and I would like to extend RoR do the same.
Both Vaadin and ZK, have an internal representation of the view in the server. When a widget is changed in the server, the framework automatically generates the javascript to modify only those changed parts of the view. As all view modifications are done in the server, it is easy to know what parts of the view are changed.
RoR has a very different approach to generate views. In fact, it uses something similar to JSP or ASP. I have been thinking in doing the extension following two different approaches:
1-Compare the current generated view and the next generated view by parsing the HTML. Then, generate the javascript to perform the changes and send it with AJAX to the client.
2-Detect the objects modified that are used in the view and then only change those parts of the view that have modified objects using AJAX.

As you may be RoR experts, could you tell me how feasibles are those approaches?