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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/videos_tasks.rb', line 6
def self.to_video
videos = OldVideo.find :all,
:include => [ :user, :city ]
videos.each do |v|
no = Video.new
no.name = v[:name]
no.seo = v[:name].to_simple_string
no.descr = v[:descr]
no.youtube_url = v[:youtube_url]
no.w = v[:w]
no.h = v[:h]
no.created_at = v[:created_at]
no.updated_at = v[:updated_at]
no.is_public = v[:is_public]
no.is_feature = v[:is_feature]
no.is_trash = v[:is_trash]
no.x = v[:x]
no.y = v[:y]
no_user = NoUser.where( :email => v.user[:email] ).first
if no_user.blank?
no_user = NoUser.new
no_user.email = v.user[:email]
no_user.save
end
no.no_user = no_user
no_city = NoCity.where( :name => v.city.name ).first
if no_city.blank?
no_city = NoCity.new
no_city.name = v.city.name
no_city.save
end
no.no_city = no_city
no.save
end
end
|