Reputation: 306
A simple test case:
<% content = "<pre>a\nb</pre>" %>
<%= raw content %>
Browser Screenshot, with inserted spaces on second line:
Here's where it gets interesting. In rails:
raw(content).size # => 14 (correct)
But, in JS:
$("pre").html().length // => 13 (should be 3)
Upvotes: 0
Views: 70
Reputation: 19889
Any chance you are using HAML for your layout? If so, that would explain it as HAML will indent things for you. You can use HAML's ~
to get around this.
See: http://haml.info/docs/yardoc/file.REFERENCE.html#tilde
Upvotes: 1