Sha256: 77b3d509f8467b313177833db05008dc9108e81246e4be57ff914fa9a372875f
Contents?: true
Size: 854 Bytes
Versions: 1
Compression:
Stored size: 854 Bytes
Contents
module Gemgento # @author Gemgento LLC class ProductCategory < ActiveRecord::Base include Gemgento::ProductTouches belongs_to :product belongs_to :category belongs_to :store touch :category, after_touch: :after_touch validates :product, :category, :store, presence: true validates :product, uniqueness: { scope: [:category, :store] } default_scope -> { order(:category_id, :position, :product_id, :id) } before_save :update_magento_category_product, if: -> { sync_needed } attr_accessor :sync_needed def update_magento_category_product response = API::SOAP::Catalog::Category.update_product(self) if response.success? self.sync_needed = false return true else errors.add(:base, response.body[:faultstring]) return false end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gemgento-2.8.0 | app/models/gemgento/product_category.rb |