class TagsTasks

Public Class Methods

name_to_name_en() click to toggle source
# File lib/tags_tasks.rb, line 37
def self.name_to_name_en
  Tag.all.each do |tag|
    tag.name_en = tag.name
    if '' == tag.name_pt
      tag.name_pt = tag.name_en
    end
    if '' == tag.name_ru
      tag.name_ru = tag.name_en
    end
    flag = tag.save
    if flag
      puts '+'
    else
      puts tag.errors.inspect
    end
  end
end
to_mongodb() click to toggle source
# File lib/tags_tasks.rb, line 6
def self.to_mongodb
  
  # get all tags
  old_tags = Tag.find :all
  
  # put them in mongoid
  old_tags.each do |old|
    new = NoTag.new
    
    new.name = old.name
    new.name_seo = old.name_seo
    # new.subhead = old.subhead
    new.descr = old.descr
    
    new.domain = 'sedux.local'
    
    new.created_at = old.created_at
    new.updated_at = old.updated_at
    
    new.is_public = 1
    new.is_feature = 0
    new.is_trash = 0
    
    new.lang = 'en'
   
    new.save
    
  end
  
end