Class: TagsTasks

Inherits:
Object
  • Object
show all
Defined in:
lib/tags_tasks.rb

Class Method Summary collapse

Class Method Details

.name_to_name_enObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 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_mongodbObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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