ruby-on-railsspreedeface

Use deface to render partial and add object, variable or locals


I am using Deface to override a spree view and I need to render a variable.

Like this: <%= render 'image_tab_partial', :type => 'vintage'%>

Using Deface:

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

I am able to render this partial but how to render :type => 'vintage' with Deface?


Solution

  • You can do the following:

    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'%>")
    

    You could also render a partial which renders your image tab partial with the type specified.