我的 HAML 模板的这个助手有什么问题?
def display_event(event)
event = MultiJson.decode(event)
markup_class = get_markup_class(event)
haml_tag :li, :class => markup_class do
haml_tag :b, "Foo"
haml_tag :i, "Bar"
end
end
这是错误:
haml_tag outputs directly to the Haml template.
Disregard its return value and use the - operator,
or use capture_haml to get the value as a String.
模板调用 display_event 是这样的:
- @events.each do |event|
= display_event(event)
如果我使用常规标记,它将扩展到以下内容
%li.fooclass
%b Foo
%i Bar