Sha256: df9094b8713a49ee7df602c213ad05efa8bae43375452bb3d5bee324eb4f740d

Contents?: true

Size: 594 Bytes

Versions: 2

Compression:

Stored size: 594 Bytes

Contents

class Plugins::Ecommerce::ProductVariation < ActiveRecord::Base
  self.table_name='plugins_ecommerce_product_variations'
  belongs_to :product, class_name: "CamaleonCms::Post"
  before_destroy :verify_related_orders

  # return all attribute values assigned to this product
  def attribute_values
    Plugins::Ecommerce::Attribute.only_value.where(id: self.attribute_ids.to_s.split(','))
  end

  private
  def verify_related_orders
    errors.add(:base, t('plugins.ecommerce.message.not_deletable_product_variations')) if Plugins::Ecommerce::ProductItem.where(variation_id: id).any?
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
camaleon_ecommerce-2.0.0 app/models/plugins/ecommerce/product_variation.rb
camaleon_ecommerce-1.2.1 app/models/plugins/ecommerce/product_variation.rb