【问题标题】:Use deface to render partial and add object, variable or locals使用 deface 渲染局部并添加对象、变量或局部变量
【发布时间】:2013-07-19 05:30:49
【问题描述】:

我正在使用 Deface 覆盖一个狂欢视图,我需要渲染一个变量。

像这样:<%= render 'image_tab_partial', :type => 'vintage'%>

使用污损:

Deface::Override.new(:virtual_path => "spree/admin/products/index", 
                     :name => "example-3",
                     :insert_after => "div#pdf_file_name", 
                     :partial => "image_tab_partial")

我可以渲染这个部分,但是如何使用 Deface 渲染 :type => 'vintage'

【问题讨论】:

    标签: ruby-on-rails spree deface


    【解决方案1】:

    您可以执行以下操作:

    Deface::Override.new(:virtual_path => "spree/admin/products/index", 
                         :name => "example-3",
                         :insert_after => "div#pdf_file_name", 
                         :text => "<%= render 'image_tab_partial', :type => 'vinatge'%>")
    

    您还可以渲染一个部分,它使用指定的类型渲染您的图像选项卡部分。

    【讨论】:

    • 所以我使用了渲染一个局部,它呈现具有指定类型的局部,只是想确认是否无法使用污损':partial =>' .....指定对象或字符串......为什么我决定发布问题......
    • 如果已经有一个部分标签而不是使用上述两种方法感觉就像一个黑客......:| ....
    • 你说得对,deface 目前不支持为 Deface 部分指定附加参数。
    猜你喜欢
    • 2015-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-16
    • 1970-01-01
    • 2011-05-14
    • 2013-04-30
    • 2011-06-17
    相关资源
    最近更新 更多