2014-06-16 4 views
1

가 content_tag 제외하고 표시 : 내가루비 온 레일즈 4 content_tag 표시되지 않습니다 : 내가 모든 content_tags 이유

def sign_full_tag(group, obj, name, input_type="text", size="12", popover=true) 
    content_tag :div, class: "row" do 
     content_tag :div, class: "col-md-" + size do 
     content_tag :div, class: "form-group left-inner-addon" + class_for_invalid_input(obj, name) do 
      content_tag(:i, "", class: "fa fa-user fa-fw text-muted") # NOT DISPLAY!!! 
      group.text_field(name, 
          class: "form-control" + (popover ? " popover-add" : ""), 
          id: name.to_s.gsub("_", "-"), 
          type: input_type, 
          placeholder: "#{t('sign_up.placeholder.' + name.to_s)}", 
          data: { container: "body", 
            toggle: "popover", 
            placement: "bottom", 
            content: (popover ? "#{t('sign_up.popover.' + name.to_s)}" : nil) }) 

     end 
     end 
    end 
    end 

내가이 도우미를 렌더링 할 때 나는 "나"내 브라우저에서 태그를 볼 수 없습니다. 어떻게하면 되나요?

답변

2

블록의 마지막 명령문 만 반환되기 때문입니다. 두 문을 하나의 문자열로 반환하도록 concat해야합니다.

content_tag(:div, etc etc) do 
    content_tag(:i, "") + group.text_field(name, etc etc) 
end