Why Ruby on Rails uses Prototype.js by default?

I recently started looking into RoR and discovered that Prototype.js is the default javascript library out of the box. Why is he using this library and why not jQuery, Dojo, Mootools, ExtJS, etc.?

+2


a source to share


5 answers


It was a choice made about five years ago and was basically just a favorite JS DHH framework at the time. Rails 3 will make it easier to maintain commutation, but for rails 2, you can always just use http://github.com/aaronchi/jrails to swap in jQuery for a prototype.



UPDATE: as of rails 3.1 it will use jquery by default and the prototype will be available via gem.

+7


a source


As Matt Briggs mentions, the prototype was the most modern 5 years ago.

TBH, it's been a very long time since I've been using the built-in javascript helpers. I am writing my apps using non-intrusive JS methods with jQuery, not the default. All you have to do is remove the default files and include any library you want in your layout.



Rails 3 changes this limitation, by the way, adding hooks for unobtrusive JS with any library.

+3


a source


If I recall correctly from the Prototype and Scriptaculous book, it was originally part of Rails and is now a side effect. The point was to make JavaScript look and feel more like Ruby.

+1


a source


At the time of writing, Prototype was not just modern, it was a library. However, if you're just using javascript_tag

jQuery to query - it will work just fine, except for your rjs helpers. However, this is changing in Rails 3 thanks to the influence of Merb and in particular Yehuda Katz (one, but not the only one, of the main members of Rails 3 Core, Merb, and jQuery)

0


a source


It's very cool how the community is now managing the Rails infrastructure. After years of being a must-have JavaScript library, we finally have the freedom to choose our favorite front-end libraries and tools: Rails 5.1: Love JavaScript, ..

0


a source







All Articles