web_resource rake web_link_url:web_link_url_i18n

This commit is contained in:
Spen authored and Matt K. Fu committed 2013-04-17 14:29:04 +08:00
1 parent aedab01ae6
commit c94a86c3a4
18 files changed
+307 -113

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
# encoding: utf-8
namespace :web_link_url do
task :web_link_url_i18n => :environment do
puts 'start'
@weblinks = WebLink.all
@weblinks.each do |wl|
if wl.url.nil?
@wlurl = wl.url_translations
wl.url_translations = {}
wl.url_translations["zh_tw"] = @wlurl
wl.url_translations["en"] = @wlurl
wl.save
else
puts 'no data'
end
end
puts 'end'
puts @weblinks.count
end
task :web_link_url_i18n_test => :environment do
@test = WebLink.find("50aca25583e75204c00009f4")
@testurl = @test.url_translations
@test.url_translations = {}
@test.url_translations["zh_tw"] = @testurl
@test.url_translations["en"] = @testurl
@test.save
end
end