Ruby on rails Rails帮助程序,concat content_标记
我试图使用一个助手在我的视图中渲染一个div,这很简单Ruby on rails Rails帮助程序,concat content_标记,ruby-on-rails,ruby,helper,Ruby On Rails,Ruby,Helper,我试图使用一个助手在我的视图中渲染一个div,这很简单 def render_form_steps_header content_tag :div , class: 'col-xs-3 bs-wizard-step complete' do content_tag :div, class: 'text-center bs-wizard-stepnum' do "Step 1" end content_tag :di
def render_form_steps_header
content_tag :div , class: 'col-xs-3 bs-wizard-step complete' do
content_tag :div, class: 'text-center bs-wizard-stepnum' do
"Step 1"
end
content_tag :div, class: 'progress' do
content_tag :div, nil, class: 'progress-bar'
end
link_to "", "", :class => "bs-wizard-dot"
end
结束
但似乎只是将最后一行链接_带到,如果我删除该行,它工作正常,并按预期返回div。有什么想法吗?已经解决了:
def render_form_steps_header
content_tag :div , class: 'col-xs-3 bs-wizard-step complete' do
str = content_tag :div, class: 'text-center bs-wizard-stepnum' do
"Step 1"
end
str += content_tag :div, class: 'progress' do
content_tag :div, nil, class: 'progress-bar'
end
str += link_to "", "", :class => "bs-wizard-dot"
end
end传递数组也可能有效。content_标记:div{content_标记的数组}