I'm surprised Ruby is the #2 language. Because, frankly, Ruby sucks [1] [2].
In general on the topic: Major reasons why Ruby and JS lead the whole thing is that a) the communities are extremely huge and active (in open source) and b) smaller modules/gems are preferred over huge frameworks (yes rails is huge, but it's actually a set of other gems - sort of). And since the author sorted by the amount of projects and not the lines of code, JS leads the list due to a ton of small modules (e.g. for node.js or component).
Rails sucking isn't necessarily Ruby's fault. If more devs actually learned Ruby and not just Rails, they'd come to appreciate that it's a fantastic dynamic language...