Closed MIbtehajNasar closed 3 years ago
This is happening to me as well, @MIbtehajNasar I see you closed the issue but I was curious to understand if you were able to fix it or what?
One workaround is to put the template in a separate erb file rather than inside the override.
I'm adding my broken code for further context:
template = <<ERB
<div class="field products_rule_products">
<%= label_tag "#{param_prefix}_product_ids_string", t('spree.product_rule.choose_products') %>
<%= hidden_field_tag "#{param_prefix}[product_ids_string]", promotion_rule.product_ids.join(","), class: "product_picker fullwidth" %>
</div>
ERB
Deface::Override.new(
name: "filter_available_products",
virtual_path: "spree/admin/promotions/rules/_product",
original: "",
replace: ".products_rule_products",
template: template
)
Which results in NameError undefined local variable or method `param_prefix' for main:Object
String interpolation is not working in deface override erb. I think It consider it as a local variable that should be define inside the file.
getting this error
undefined local variable or method
k' for main:ObjectHint:
k
is probably misspelled.`