0
사이에이 코드를 나누기 :레일 도우미 - 라인 도우미에 태그
def dgtags
if params[:controller]=='my_controller'
javascript_include_tag('dygraph-combined.js') <<
tag(:meta, :http_equiv => 'X-UA-Compatible', :content => 'IE=EmulateIE7; IE=EmulateIE9') <<
'<!--[if IE]>'.html_safe <<
javascript_include_tag('excanvas.compiled.js') <<
'<![endif]-->'.html_safe
end
end
는 다음과 같은 출력을 생성합니다
<script src="/javascripts/dygraph-combined.js?1338036501" type="text/javascript"></script><meta content="IE=EmulateIE7; IE=EmulateIE9" http_equiv="X-UA-Compatible" /><!--[if IE]><script src="/javascripts/excanvas.compiled.js?1237712986" type="text/javascript"></script><![endif]-->
어떻게 라인 태그 사이에 나누기 삽입? - 그것은 N \ 그대로 생산
<script src="/javascripts/dygraph-combined.js?1338036501" type="text/javascript"></script>
<meta content="IE=EmulateIE7; IE=EmulateIE9" http_equiv="X-UA-Compatible" />
<!--[if IE]><script src="/javascripts/excanvas.compiled.js?1237712986" type="text/javascript"></script><![endif]-->
'\ n'또는 '\의 n'.html_safe 도움이되지 않습니다 : 이것처럼. 난 당신의 코드를 약간 변경 한 http://en.wikibooks.org/wiki/Ruby_Programming/Strings
:
특히 예를 들어 주셔서 감사합니다. – Paul