@courses into a js variable called
window.courses. I've got the following in an
I'm expecting the
... but, instead, I'm getting code that includes HTML entities.
If you intend to use raw(obj.to_json) you MUST ensure the following is set.
ActiveSupport.escape_html_entities_in_json = true
The question is solved by my comment, just for the record:
Rails escapes strings that are printed using
<%= 'string' %>. By this, it is save to ouput user data.
So, if you don't want Rails to escape the output, you have to tell Rails explicitly by using
In your code, that would be:
<%= raw(@courses.to_json) %>
©2020 All rights reserved.