11

I am new to the Rails word. Using Rails 6 and following the guides / tutorials. On the official Rails guides, there are CoffeeScript examples and it's even recommended to use CoffeeScript, see: https://guides.rubyonrails.org/working_with_javascript_in_rails.html#an-introduction-to-ajax (even in the edge guides: https://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html#an-introduction-to-ajax).

As an experienced JavaScript developer, I have never seen for the past three years any company choosing CoffeeScript as their JavaScript tool. Thanks to the innovations from CoffeeScript JavaScript has evolved and the need for CoffeeScript disappeared.

Now why would Rails still recommend it? I feel like it will most probably confuse newcomers to Rails because for most of the new developers, CoffeeScript is not even a thing anymore. It's a good history lesson if you read it about JavaScript but that's it.

Thanks!

vvo
  • 2,653
  • 23
  • 30
  • Think this is more opinion based rather than anything. I think it's just because Rails is a pretty old framework, and back then, Coffeescript had a lot of features that Javascript didn't get until like 3-4 years ago. Coffeescript is essentially JS but nicer to read, but I think generally hardly anyone uses Coffeescript anymore, even among the Rails communtiy. But eh, that's just what I got from googling and reading. – TedTran2019 Nov 18 '19 at 11:05
  • This is not really a good question for stackoverflow as its very hard if not impossible to answer objectively. Right now I would say the reason is probably that the guides don't get enough love. If you want a real answer to this question you should try the [Rails guides mailing list](https://groups.google.com/forum/#!forum/rubyonrails-docs). – max Nov 18 '19 at 11:52
  • Ah good I was searching for something like that, the default "Ask for help" on the rails website is redirecting here. – vvo Nov 18 '19 at 12:06
  • That particular Ajax guide was written quite a while ago back when CS was the hottest thing since sliced toast. Even back then it really annoyed me that they didn't just write it in JS. If you look at newer stuff like the ActionCable guide its all JS. – max Nov 18 '19 at 12:06
  • "Thanks to the innovations from CoffeeScript JavaScript has evolved and the need for CoffeeScript disappeared." My 2ct's: They might have included *some* innovations from CoffeeScript, but CoffeeScript is still way ahead in that respect. Rails and DHH have always stood for quality and enjoyable coding, over trying to win popularity contests. Otherwise they wouldn't have chosen Ruby for their framework, and wouldn't still stick with it, now that Ruby is less "trendy". That is probably why the core of the Rails community still prefers CoffeeScript and why they still recommend it. – zor-el May 18 '20 at 08:48

3 Answers3

5

I arrived here from googling the same thing. Here's what I learned in the last 30 min:

  • There was a lot of discussion about updating the rails guides to remove coffeescript
    • That took place, and recent versions of rails guides do not reference coffeescript any more
  • Anecdotal, but some very experienced rails devs I asked about this do not use coffeescript any more.

Now JS is a quite decent language, so there’s no reason to use CoffeeScript anymore. Also, I don’t think that there’s anyone maintaining

Based on this info:

  • I will use up to date rails guides (that don't use coffeescript)
  • I won't use or learn coffeescript
stevec
  • 41,291
  • 27
  • 223
  • 311
2

There's a pull request opened to change the information: https://github.com/rails/rails/pull/37529

vvo
  • 2,653
  • 23
  • 30
0

CoffeeScript is no longer recommended by the Rails community. RIP Coffeescript.

Jeremy Lynch
  • 6,780
  • 3
  • 52
  • 63