" instead of " in js code rendered by erb

Having problems rendering javascript in erb file. Thanks for
suggestions.

//layout erb file
(function() {


var widget_properties = {};
<%= content_for?(:extend_widget) ? "widget_properties = " +
yield(:extend_widget) : ‘’ %>

})();

//view erb file
<% content_for :extend_widget do %>
extend = {
_init: function() {
$(“input[type=‘checkbox’]”, this).live(‘click’, function() {

});
}
}

<% end %>

//resulting script - notice the " instead of " in code below
(function() {

widget_properties = extend = {
_init: function() {
$(“input[type=‘checkbox’]”, this).live(‘click’,
function() {

On Mar 8, 2011, at 11:14 PM, slava wrote:


}
function() {

Rails 3 erb applies h() to most strings automatically. Instead of
having to remember to apply h, you have to remember to mark the
strings you want to be left alone as html_safe or raw. I don’t know
the precise syntax to use in your case, but that’s where I would start
looking.

Walter

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs