Section 5.4. Summary


5.4. Summary

In this chapter we discovered and explored the approach to Ajax that's unique to Rails: RJS. Initially, we explored why JavaScript makes more sense as a format for delivering responses to Ajax requests than a static, data-centric format such as HTML.

Next, we looked at the benefits of generating JavaScript from Ruby, such as, working with Ruby's elegant syntax, and easily mixing in other Rails features (e.g., rendering partials and generating URLs).

After that, we saw how the RJS syntax itself can be divided into a few major sections: element proxies (an RJS object that represents a single DOM element), collection proxies (an RJS object that represents a group of DOM elements), and everything else (the RJS methods that apply to the entire page, such as redirects and arbitrary JavaScript calls).

Then we looked at the techniques for getting the most out of RJS, such as extracting common functionality into RJS helpers and reusing those pieces elsewhereeven without remote Ajax requests.




Ajax on Rails
Ajax on Rails
ISBN: 0596527446
EAN: 2147483647
Year: 2006
Pages: 103
Authors: Scott Raymond

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net