Js.erb ERROR invalid XML character

Good morning,

i am trying to write a js.erb.

<% if current_user.login == “admin” %>
var hide = false;
<% else %>
var hide = true;
<% end %>


<% escape_javascript(if current_user.login == “admin”) %>
var hide = false;
<% escape_javascript(else) %>
var hide = true;
<% escape_javascript(end) %>

but every time I got an error in firebug: “invalid XML character”.

Can’t we just embended ruby in a javascript file?

Thank you

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