Module: Spree::Admin::ProductPropertiesHelper

Defined in:
app/helpers/spree/admin/product_properties_helper.rb

Instance Method Summary collapse

Instance Method Details

#property_fu_name(product_property, number) ⇒ Object

Generates the appropriate field name for attribute_fu. Normally attribute_fu handles this but we’ve got a special case where we need text_field_with_autocomplete and we have to recreate attribute_fu’s naming scheme manually.



7
8
9
10
11
12
13
# File 'app/helpers/spree/admin/product_properties_helper.rb', line 7

def property_fu_name(product_property, number)
  if product_property.new_record?
    "product[product_property_attributes][new][#{number}][property_name]"
  else
    "product[product_property_attributes][#{product_property.id}][property_name]"
  end
end

#property_fu_value(product_property, number) ⇒ Object



15
16
17
18
19
20
21
# File 'app/helpers/spree/admin/product_properties_helper.rb', line 15

def property_fu_value(product_property, number)
  if product_property.new_record?
    "product[product_property_attributes][new][#{number}][value]"
  else
    "product[product_property_attributes][#{product_property.id}][value]"
  end
end