I’m experiencing a very strange behavior in my application right now. I have a layout that renders several different snippets of html within it. Here is the layout file:
<!DOCTYPE html>
<html lang="en" ng-app="crossroads">
<head>
<%= render CrossroadsInterface.SharedView, "common_head.html", assigns %>
<%= render_existing @view_module, "head.html", assigns %>
</head>
<body>
<%= render @view_module, @view_template, assigns %>
<%= render CrossroadsInterface.SharedView, "common_body.html", assigns %>
<%= render_existing @view_module, "body.html", assigns %>
</body>
</html>
In the common_head.html
file, I’ve got the following line:
<%= raw(render(MyApplication.SharedView, "cr.svg", assigns)) %>
When this line is present in my code, I get the following strange behavior; content from the head.html
file gets ripped out from being in between my <head></head>
tags and gets dumped into the document immediately following the <body>
tag. When I remove the line:
<%= raw(render(MyApplication.SharedView, "cr.svg", assigns)) %>
then head.html
contents get rendered between the <head></head>
tags as expected. I get the exact same behavior when I replace the contents of
<%= raw(render(MyApplication.SharedView, "cr.svg", assigns)) %>
with
<%= raw("<div id="foobar">My foobar</div>) %>
It appears that raw/1 has some unexpected side effects. Does anyone have any ideas as to why raw/1 would create this kind of behavior in my application? Thanks in advance to anyone who can offer up any ideas.