Js.erb ERROR invalid XML character


#1

Good morning,

i am trying to write a js.erb.

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

or

<% 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