레일에 루비 HAML위한 도우미 또는 무언가를 만들고 내가 가장 쉬운 방법은 HTML 파일에이 HAML 코드를 삽입하는 방법을 질문 있습니다내 레일 응용 프로그램과 HAML을 사용하고
<div clas="holder">
<div class=top"></div>
<div class="content">
Content into the div goes here
</div>
<div class="bottom"></div>
</div>
그리고 난을 내 햄 문서에서 다음과 같이 사용하고 싶습니다.
더 쉬운 방법이 있나요? 이 코드
**unexpected $end, expecting kEND**
:
나는이 오류가
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
def content_box(&block)
open :div, :class => "holder" do # haml helper
open :div, :class => "top"
open :div, :class => "content" do
block.call
open :div, :class => "bottom"
end
end
end
다른 답변에 대한 의견을 읽으십시오. 어느 것이 가장 많습니까? 응용 프로그램의 속도 측면에서 효과가 있습니까? – Lisinge
속도의 차이는 실제로 nul입니다. 도우미 메서드는 그것을 사용하는 것이 좋습니다. – shingara