How to embed Ruby in JavaScript (Rails + .html.erb file)

Viewed 35708

I have a .html.erb file, with some javascript in it. I would like to do something like this:

var stuff = '<div><%= @ruby_var.title %></div>'

What is the best way to do this? I may be totally off... Thanks.

4 Answers
Related