以下声明...
content_tag(:li, concept.title)
...返回类似:
<li>"My big idea"</li>
以下方法定义在调用时返回相同:
def list_of_concepts(part)
content_tag(:li, concept.title)
end
一样...
def list_of_concepts(part)
content_tag(:li, part.concepts.first.title)
end
但是下面...
def list_of_concepts(part)
for concept in part.concepts
content_tag(:li, concept.title)
end
end
...在我看来,只是给了我一堆英镑符号(“ #
”),就像它返回 true 或 false 或计数而不是content_tag
返回任何东西。我怎样才能让它返回什么content_tag
返回?
再次感谢,
史蒂文。