rails helper嵌套content_tag,其中span在link_to中

时间:2015-09-03 20:41:30

标签: ruby-on-rails ruby-on-rails-4 actionviewhelper

嗨,我已经尝试过几乎所有的东西而且无法让它发挥作用。 title.capitalize部分未显示。我尝试使用" +"但后来我得到关于期待结束关键字的错误

def mailbox_section(title, current_box, opts = {})
  content_tag :li, opts do 
    link_to(conversations_path(box: title.downcase), html_opts = {}) do
      title.capitalize
      content_tag :span, :class => "badge" do  
        "2" 
      end
    end
  end     
end

有没有人知道如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

也许字符串插值可以将两个部分都放入链接文本字符串中?为了清晰起见,在嵌套用法中切换到块上的单引号和花括号。

                ' Clear links and colour formatting from the WEBLink col etc:  _Buggsie.178
            With p_wksCompDetailReport
                .Unprotect Password:=PROTECT_PASSWORD
                If .Hyperlinks.Count > 0 Then
                    .Hyperlinks.Delete
                End If
                With .Range(p_typCDCols.strWebLinkCol & REPORT_DATA_ROW_START & ":" & p_typCDCols.strWebLinkCol & p_lngRowLast)
                    .Interior.ColorIndex = xlNone
                    .Cells.Clear
                End With
            End With

答案 1 :(得分:1)

感谢Ed基于此我能够做到这一点

java.lang.RuntimeException: Cannot resolve reference Local ejb-ref name=com.mycompnayl.business.model.web.stage.p1.P1RawGridSessionBean/productSessionLocal,Local 3.x interface =com.mycompany.business.component.product.ProductSessionLocal,ejb-link=null,lookup=,mappedName=,jndi-name=,refType=Session
    at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:620d
    at com.sun.enterprise.deployment.WebBundleDescriptor.visit(WebBundleDescriptor.java:2004)
    at com.sun.enterprise.deployment.Application.visit(Application.java:1777)