=image_tag('/images/public_stream_page/overlay_image.png',
:onload=>"document.getElementById('dd_mid_right_box_public').style.background='url(#{stream.asset.url(:normal)})';")
This is my haml code to display an image
so am getting this errorThe line was indented 2 levels deeper than the previous line.
How to resol开发者_StackOverflow社区ve it?
Probably not the direct answer to OP's question, but I ran into this error because the first few lines of my HAML were only indented by one space, and then it ran into a section of the document that was indented using two spaces. Apparently the HAML processor uses the first couple of lines to figure out how many spaces are in an indent, and then it enforces that throughout.
You're not displaying the code in a correct way for a problem that relates to space indentation... Also line numbers would help. You should have something like this:
- if stream.asset?
=image_tag('/images/public_stream_page/overlay_image.png',:onload=>"document.getElementById('dd_mid_right_box_public').style.background='url(#{stream.asset.url(:normal)})';")
With the second line indented with the same number of spacing you use in the rest of your templeate, while perhaps you have one line (number in the error not shown) 2 times more indented.
精彩评论