lib/loaders/spree/product_loader.rb
def add_translation
        list=  get_each_assoc
        list.each do |element|

          translations = element.split("-:-")

          return  if translations.count < 4

          title = translations.first
          description = translations[1]

          title_ru = translations[2]
          description_ru = translations.last


          begin

            trans = Spree::Product::Translation.find_or_initialize_by(:spree_product_id => @load_object.id,:locale => "en")
            trans.update(:name => title, :description => description ,:meta_description => description ,:meta_keywords=> title)

            trans = Spree::Product::Translation.find_or_initialize_by(:spree_product_id => @load_object.id,:locale => "ru")
            trans.update(:name => title_ru, :description => description_ru ,:meta_description => description_ru ,:meta_keywords=> title_ru)

          rescue Exception => ex
            logger.info "failed to create translation process method , ex = #{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_translation
        list=  get_each_assoc
        list.each do |element|
          translations = element.split("-:-")
          return  if translations.count < 4
          title = translations.first
          description = translations[1]
          title_ru = translations[2]
          description_ru = translations.last
          begin
            trans = Spree::Product::Translation.find_or_initialize_by(:spree_product_id => @load_object.id,:locale => "en")
            trans.update(:name => title, :description => description ,:meta_description => description ,:meta_keywords=> title)
            trans = Spree::Product::Translation.find_or_initialize_by(:spree_product_id => @load_object.id,:locale => "ru")
            trans.update(:name => title_ru, :description => description_ru ,:meta_description => description_ru ,:meta_keywords=> title_ru)
          rescue Exception => ex
            logger.info "failed to create translation process method , ex = #{ex.message}"
          end
        end
      end
def add_translation list = get_each_assoc list . each do | element | translations = element . split ( "-:-" ) return if translations . count < 4 title = translations . first description = translations [ 1 ] title_ru = translations [ 2 ] description_ru = translations . last begin trans = Spree :: Product :: Translation . find_or_initialize_by ( :spree_product_id => @load_object . id , :locale => "en" ) trans . update ( :name => title , :description => description , :meta_description => description , :meta_keywords => title ) trans = Spree :: Product :: Translation . find_or_initialize_by ( :spree_product_id => @load_object . id , :locale => "ru" ) trans . update ( :name => title_ru , :description => description_ru , :meta_description => description_ru , :meta_keywords => title_ru ) rescue Exception => ex logger . info "failed to create translation process method , ex = #{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