lib/loaders/spree/product_loader.rb
def add_items_on_hand
        property_list = get_each_assoc
        property_list.each do |prop|

          begin
            item = @@stockItem_klass.find_by(:variant_id => @load_object.master.id)
            item = @@stockItem_klass.create  if !item
            item.stock_location=Spree::StockLocation.first_or_create!(name: 'default')
            item.variant_id =@load_object.master.id
            item.set_count_on_hand(prop)
            item.save
          rescue  Exception =>  ex
            logger.error " Exception on creationg stock item = " + ex.message
          end
        end
      end
# Options
#
#  :reload           : Force load of the method dictionary for object_class even if already loaded
#  :verbose          : Verbose logging and to STDOUT
#
Options
:reload           : Force load of the method dictionary for object_class even if already loaded
:verbose          : Verbose logging and to STDOUT
Options : reload : Force load of the method dictionary for object_class even if already loaded : verbose : Verbose logging and to STDOUT
def add_items_on_hand
        property_list = get_each_assoc
        property_list.each do |prop|
          begin
            item = @@stockItem_klass.find_by(:variant_id => @load_object.master.id)
            item = @@stockItem_klass.create  if !item
            item.stock_location=Spree::StockLocation.first_or_create!(name: 'default')
            item.variant_id =@load_object.master.id
            item.set_count_on_hand(prop)
            item.save
          rescue  Exception =>  ex
            logger.error " Exception on creationg stock item = " + ex.message
          end
        end
      end
def add_items_on_hand property_list = get_each_assoc property_list . each do | prop | begin item = @@stockItem_klass . find_by ( :variant_id => @load_object . master . id ) item = @@stockItem_klass . create if ! item item . stock_location = Spree :: StockLocation . first_or_create! ( name : 'default' ) item . variant_id = @load_object . master . id item . set_count_on_hand ( prop ) item . save rescue Exception => ex logger . error " Exception on creationg stock item = " + ex . message end end end
Options
:reload           : Force load of the method dictionary for object_class even if already loaded
:verbose          : Verbose logging and to STDOUT
Options : reload : Force load of the method dictionary for object_class even if already loaded : verbose : Verbose logging and to STDOUT