9.6. Alternatives

Rails is opinionated software, and as such ships with a set of sensible defaults. As you have seen throughout this chapter, Rails assumes that you'll be using ERb, Builder, and RJS templates, and that you're going to employ Prototype and script.aculo.us. But it's important to understand that you are not limited to these options. Should you prefer a different template engine, you are free to adopt one instead of ERb. Common choices are Haml (http://haml.hamptoncatlin.com) and Liquid (http://www.liquidmarkup.org). If you'd like to simplify writing CSS, you can also check Haml's sister project, Saas.

Regarding Ajax, more than 200 frameworks are out there. Prototype is one of the best and most popular, but should you feel inclined to work with a different framework, you can copy it over in public\javascripts, include it with javascript_include_tag, and then it will be ready for you to use whenever you like. Of course, you'd be using JavaScript, as opposed to comfortable Ruby wrappers, but you can always define your own Ruby helpers and perhaps share and distribute them with others as a plugin. In fact, many plugins for alternative JavaScript libraries exist or are under development at the moment.

One JavaScript library in particular has been gaining a lot of momentum: jQuery. It's very light, fast, powerful, and well written, and it's been able to catch the interest of many Rails developers. If you are among the legions of jQuery fans, you should use the jRails plugin ...

Get Ruby on Rails® for Microsoft Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.