Ruby Array to Javascript Array

Need to pass a Ruby Array to a Javascript Array? Here’s a little gem I found a while ago that I’m reusing in my current project.

>> a_ruby_array = ["one", "two", "three"]
=> ["one", "two", "three"]
>> "['#{a_ruby_array.join('\',\'')}']"
=> "['one','two','three']"