tags:

views:

40

answers:

2

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.

+1  A: 

Ruby can't be run on the client, at least not with specialized browser plugins. Instead, look at using AJAX and RJS to query your Ruby web application from Javascript and insert any text it returns into your page.

Without more information, I don't think you're going to get any better answers. I might be totally off too, because I'm only guessing at what you really want to do.

AboutRuby
+3  A: 
<script>
 var stuff = '<%= @ruby_var.title %>'
</script>

in your .html.erb file will work fine.

danielsherson