smcdrc
smcdrc

Reputation: 1691

Spree/Deface - Conditionally set an override

Is there a way to conditionally set a deface override, for example based on product?

So product == 'x', then do it, otherwise, ignore.

Upvotes: 0

Views: 806

Answers (1)

gmacdougall
gmacdougall

Reputation: 4911

Your best bet will be to conditionally use render_original like so:

Deface::Override.new(:virtual_path => "products", 
                     :name => "example", 
                     :surround => "div#products",
                     :text => "<% if @product == 'x' %><%# do something %><% else %><%= render_original %><% end %>")

Upvotes: 4

Related Questions