Forum: Ruby on Rails js.erb ERROR invalid XML character

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
da991319 (Guest)
on 2009-01-20 16:15
(Received via mailing list)
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 topic is locked and can not be replied to.