This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/lib/tasks/web_link_url.rake

52 lines
777 B
Ruby

# 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