मैं अपने रेल आवेदन के साथ haml उपयोग कर रहा हूँ पर गहरे लाल रंग का के साथ एक सहायक या haml के लिए कुछ बना सकते हैं और मैं एक सवाल यह है कि सबसे आसान तरीका है एक HTML फ़ाइल में इस haml कोड डालने के लिए है:रेल
<div clas="holder">
<div class=top"></div>
<div class="content">
Content into the div goes here
</div>
<div class="bottom"></div>
</div>
और मैं इसे अपने हैमल दस्तावेज़ में इसका उपयोग करना चाहते हैं:
%html
%head
%body
Maybee some content here.
%content_box #I want to get the code i wrote inserted here
Content that goes in the content_box like news or stuff
%body
क्या ऐसा करने का कोई आसान तरीका है? इस कोड के साथ
**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
गति का अंतर वास्तव में शून्य है। सहायक उपयोग इसका उपयोग करने के लिए बहुत अच्छा है। – shingara