app/models/plugins/ecommerce/attribute.rb in camaleon_ecommerce-1.2 vs app/models/plugins/ecommerce/attribute.rb in camaleon_ecommerce-1.2.1

- old
+ new

@@ -4,6 +4,9 @@ has_many :values, class_name: 'Plugins::Ecommerce::Attribute', foreign_key: :parent_id, dependent: :destroy belongs_to :product_attribute, class_name: 'Plugins::Ecommerce::Attribute', foreign_key: :parent_id scope :only_group, ->{ where(parent_id: nil) } scope :only_value, ->{ where.not(parent_id: nil) } default_scope ->{ order(position: :ASC) } + def translated_values + values.select(:id, :label, :key).map{|item| item.label = item.label.to_s.translate; item } + end end