# Default JavaScript library

**URL:** <https://discuss.rubyonrails.org/t/default-javascript-library/51877>\
**Category:** rubyonrails-core\
**Created:** [May 24, 2010, 3:54pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877 "2010-05-24T15:54:15Z")\
**Posts on this page:** 17\
**Page:** 2

<div class="post-metadata">

**Author:** ![Neeraj\_Singh](https://avatars.discourse-cdn.com/v4/letter/n/90db22/32.png) [@Neeraj\_Singh](https://discuss.rubyonrails.org/u/Neeraj_Singh)\
**Post date:** [May 27, 2010, 3:43pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/21 "2010-05-27T15:43:01Z")

</div>

This is that api I propose. If it is agreed upon by core team then a patch can easily be created.

# create a demo app with prototype javascript # in this way current behavior is not changed

> rails init demo

# create a demo app with latest stable jquery # [GitHub - rails/jquery-ujs: Ruby on Rails unobtrusive scripting adapter for jQuery](http://github.com/rails/jquery-ujs) should have a jquery-versions.txt file which lists all the stable releases of jquery. That file will be referred # on runtime and the latest stable version will be found which would be 1.4.2 as of this writing

> rails init demo -j=jquery

# create a demo app with jquery version 1.4.1

> rails init demo -j=jquery:1.4.1

# create a demo app with mootools version 1.2.4

> rails init demo -j=mootools:1.2.4

Once this kind of api is in place then I don't care what is the default JavaScript library that ships with rails.

Thoughts?

---

<div class="post-metadata">

**Author:** ![fxn](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/fxn/32/12956_2.png) [@fxn](https://discuss.rubyonrails.org/u/fxn)\
**Post date:** [May 27, 2010, 3:45pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/22 "2010-05-27T15:45:51Z")

</div>

But you are talking perceptions, and the sample talks numbers.

Of course 16% has to be taken with some margins, but you can't deny it makes difficult to claim that the vast majority of Rails developers use jQuery exclusively, which was the claim in (1). That is a strong claim! (1 was originally stated as a feeling not a fact, that's fine).

If the percent had been 84% then there would be no doubt about it, right? But \< 20%... dubious.

But it turns out the 84% seems to support that the vast majority are using Prototype, no matter which is our termometer.

Hey, I am not saying people can't advocate jQuery because of a series of reasons. I am only raising a flag about this claim about the perceived user base.

---

<div class="post-metadata">

**Author:** ![Mateo\_Murphy](https://avatars.discourse-cdn.com/v4/letter/m/ec9cab/32.png) [@Mateo\_Murphy](https://discuss.rubyonrails.org/u/Mateo_Murphy)\
**Post date:** [May 27, 2010, 3:51pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/23 "2010-05-27T15:51:11Z")

</div>

I think in reality, most rails developers end up using both; prototype because it's the default, and jquery because of the large library of plugins. I do think that supports a move to using jquery as default, despite preferring prototype myself.

---

<div class="post-metadata">

**Author:** ![Andy\_Jeffries](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/andy_jeffries/32/14286_2.png) [@Andy\_Jeffries](https://discuss.rubyonrails.org/u/Andy_Jeffries)\
**Post date:** [May 27, 2010, 3:55pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/24 "2010-05-27T15:55:22Z")

</div>

> Of course 16% has to be taken with some margins, but you can't deny it makes difficult to claim that the vast majority of Rails developers use jQuery exclusively, which was the claim in (1). That is a strong claim! (1 was originally stated as a feeling not a fact, that's fine).
> 
> If the percent had been 84% then there would be no doubt about it, right? But \< 20%... dubious.
> 
> But it turns out the 84% seems to support that the vast majority are using Prototype, no matter which is our termometer.

I completely disagree, just because people don't use jrails, doesn't mean they're a prototype user. I generally bring in jQuery manually and delete all the prototype cruft from my projects, but I then write my own jQuery code to do specifically what I want, ignoring Rails helpers.

You can't assume that 16% jRails = 16% jQuery - it would be true if that was the only way of using jQuery with Rails, but it so blatantly isn't.

Cheers,

Andy

---

<div class="post-metadata">

**Author:** ![Norman\_Clarke1](https://avatars.discourse-cdn.com/v4/letter/n/f04885/32.png) [@Norman\_Clarke1](https://discuss.rubyonrails.org/u/Norman_Clarke1)\
**Post date:** [May 27, 2010, 3:58pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/25 "2010-05-27T15:58:48Z")

</div>

This is why I stated that once Rails 3 comes out, it should be easier to get some "real" numbers on this, since presumably it will be just as easy for developers to use jQuery as it currently is to use Prototype, and those users who actively program in Javascript rather than just using the helpers will consciously decide to use one or the other.

I would suggest it's a bit late to change the default option at this time, and if the decision is left for 3.1 it can easily be based at least in part on real-world numbers that nobody disputes.

---

<div class="post-metadata">

**Author:** ![Adam\_Hunter1](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@Adam\_Hunter1](https://discuss.rubyonrails.org/u/Adam_Hunter1)\
**Post date:** [May 27, 2010, 4:00pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/26 "2010-05-27T16:00:41Z")

</div>

Taking a sampling of libraries from the home pages of the six example sites listed on [http://rubyonrails.org/](http://rubyonrails.org/) (Who is already on Rails?)

jQuery: Twitter, Shopify, Yellow Pages, Github

Prototype: Basecamp, Lighthouseapp

I only looked at the source of the home pages, and may have missed a jQuery also using Prototype and vice versa.

- Adam

---

<div class="post-metadata">

**Author:** ![fxn](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/fxn/32/12956_2.png) [@fxn](https://discuss.rubyonrails.org/u/fxn)\
**Post date:** [May 27, 2010, 4:10pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/27 "2010-05-27T16:10:15Z")

</div>

I know!

The problem is to gauge which percent does that represent. Do you claim that there's a 50% of people using jQuery exclusively without jRails to be able to sum up say 70%?

My hypothesis is that that percent is small, and this is of course speculation. But speculation based on the fact that generally speaking one prefers to keep the helpers if the cost is as cheap as installing jRails.

I am not claiming 16% is the exact figure, this is a sample, there's that other variable. What I say is that the numbers do not seem to \*\*support\*\*, to bring some evidence in favor of (1), on the contrary.

---

<div class="post-metadata">

**Author:** ![Daniel\_Schierbeck](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daniel\_Schierbeck](https://discuss.rubyonrails.org/u/Daniel_Schierbeck)\
**Post date:** [May 27, 2010, 4:51pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/28 "2010-05-27T16:51:24Z")

</div>

Xavier, I for one never use jRails -- in fact, neither do most of the rails devs i know. We do, however, use jQuery.

The JavaScript helpers in Rails 2.3 were rather ugly, from a jQuery point of view, which probably explains why not that many people felt like using jRails.

Daniel

---

<div class="post-metadata">

**Author:** ![Ernie\_Miller2](https://avatars.discourse-cdn.com/v4/letter/e/73ab20/32.png) [@Ernie\_Miller2](https://discuss.rubyonrails.org/u/Ernie_Miller2)\
**Post date:** [May 27, 2010, 4:54pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/29 "2010-05-27T16:54:40Z")

</div>

Seconded. We use jQuery for almost all of our projects around here, but don't bother with jRails because of the ugly factor.

---

<div class="post-metadata">

**Author:** ![radar](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/radar/32/604_2.png) [@radar](https://discuss.rubyonrails.org/u/radar)\
**Post date:** [May 27, 2010, 8:59pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/30 "2010-05-27T20:59:34Z")

</div>

I would not go changing this in a minor release. Major or bust.

Ryan Bigg / Radar

---

<div class="post-metadata">

**Author:** ![Daniel\_Schierbeck](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daniel\_Schierbeck](https://discuss.rubyonrails.org/u/Daniel_Schierbeck)\
**Post date:** [May 27, 2010, 9:22pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/31 "2010-05-27T21:22:43Z")

</div>

I personally disagree. With a limit backwards compatibility, current Prototype users could have a simple command line switch to regain their old default. Furthermore, I feel that the default JS library is the least coupled piece of Rails 3 -- changing it is rather unobtrusive, as long as bindings are available for the major frameworks.

Cheers, Daniel

---

<div class="post-metadata">

**Author:** ![Norman\_Clarke1](https://avatars.discourse-cdn.com/v4/letter/n/f04885/32.png) [@Norman\_Clarke1](https://discuss.rubyonrails.org/u/Norman_Clarke1)\
**Post date:** [May 27, 2010, 9:24pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/32 "2010-05-27T21:24:12Z")

</div>

Why? SQLite3 was made the default database in 2.0.2 and the world didn't stop. It's a change that affects people creating new Rails applications - not ones that have already been created.

I'm a big fan of jQuery too but maybe at this point it would be nice to take an issue off the core team's table. At the end of the day Rails 3 is still going to work great no matter what the default is.

---

<div class="post-metadata">

**Author:** ![Yehuda\_Katz](https://avatars.discourse-cdn.com/v4/letter/y/f14d63/32.png) [@Yehuda\_Katz](https://discuss.rubyonrails.org/u/Yehuda_Katz)\
**Post date:** [May 27, 2010, 9:36pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/33 "2010-05-27T21:36:52Z")

</div>

I agree. Let’s get 3.0 out and table this until then.

Deal?

Yehuda Katz Architect | Engine Yard (ph) 718.877.1325

---

<div class="post-metadata">

**Author:** ![radar](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/radar/32/604_2.png) [@radar](https://discuss.rubyonrails.org/u/radar)\
**Post date:** [May 27, 2010, 9:57pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/34 "2010-05-27T21:57:47Z")

</div>

> Why? SQLite3 was made the default database in 2.0.2 and the world
> 
> didn’t stop. It’s a change that affects people creating new Rails
> 
> applications - not ones that have already been created.

There’s a big difference between changing the default database system and changing the default javascript engine. For a very basic example: Model.create will work the same on whatever database system you’re using where $(‘blog\_1’) will behave differently depending on the javascript engine.

I see your point.

> I’m a big fan of jQuery too but maybe at this point it would be nice
> 
> to take an issue off the core team’s table. At the end of the day
> 
> Rails 3 is still going to work great no matter what the default is.

Indeed and I’ll agree with Yehuda here. 3.0’s gotta be out soon, right?

---

<div class="post-metadata">

**Author:** ![akaspick](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@akaspick](https://discuss.rubyonrails.org/u/akaspick)\
**Post date:** [May 27, 2010, 11:34pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/35 "2010-05-27T23:34:45Z")

</div>

I'd like to see vbscript as the default, but I guess we can wait until Rails 3 ships first.

---

<div class="post-metadata">

**Author:** ![Daniel\_Schierbeck](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daniel\_Schierbeck](https://discuss.rubyonrails.org/u/Daniel_Schierbeck)\
**Post date:** [May 28, 2010, 10:08am UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/36 "2010-05-28T10:08:33Z")

</div>

I think Rails 3.1 would be the appropriate target.

Daniel

---

<div class="post-metadata">

**Author:** ![fxn](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/fxn/32/12956_2.png) [@fxn](https://discuss.rubyonrails.org/u/fxn)\
**Post date:** [June 14, 2010, 4:47pm UTC](https://discuss.rubyonrails.org/t/default-javascript-library/51877/37 "2010-06-14T16:47:11Z")

</div>

We discussed in this thread usage stats. Usage stats seem to favor Prototype, though of course it has been the default since the beginning and that matters.

On the other hand, stats about what people prefer \*now\* suggest that's clearly jQuery:

&nbsp;&nbsp;&nbsp;&nbsp;[http://survey.hamptoncatlin.com/survey/stats](http://survey.hamptoncatlin.com/survey/stats)

I think this number is worth taking into account.

[Previous page](https://discuss.rubyonrails.org/t/default-javascript-library/51877.md?page=1)
