2014-07-19 16:41:29 +08:00
|
|
|
# -*coding:utf-8 -*-
|
|
|
|
class RepairFirstPage < ActiveRecord::Migration
|
|
|
|
def change
|
|
|
|
pro_fps = FirstPage.where("page_type = 'project'")
|
|
|
|
if pro_fps.nil? || pro_fps.first.nil?
|
|
|
|
fp = FirstPage.new
|
|
|
|
fp.web_title = "Trustie - 为大学生技术创新筑巢"
|
|
|
|
fp.title = "Trustie在线项目托管平台"
|
|
|
|
fp.description = "面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
|
|
|
|
fp.page_type = "project"
|
|
|
|
fp.sort_type = 1
|
2014-07-31 13:40:02 +08:00
|
|
|
fp.save(:validate => false)
|
2014-07-19 16:41:29 +08:00
|
|
|
else
|
|
|
|
fp = pro_fps.first
|
|
|
|
fp.web_title = "Trustie - 为大学生技术创新筑巢"
|
|
|
|
fp.title = "Trustie在线项目托管平台"
|
|
|
|
fp.description = "面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
|
|
|
|
fp.page_type = "project"
|
|
|
|
fp.sort_type = 1
|
2014-07-31 13:40:02 +08:00
|
|
|
fp.save(:validate => false)
|
2014-07-19 16:41:29 +08:00
|
|
|
end
|
|
|
|
course_fps = FirstPage.where("page_type = 'course'")
|
|
|
|
if course_fps.nil? || course_fps.first.nil?
|
|
|
|
fp = FirstPage.new
|
|
|
|
fp.web_title = "Trustie - 为大学生技术创新筑巢"
|
|
|
|
fp.title = "Trustie在线课程实践平台"
|
|
|
|
fp.description = "面向中国高校教师与大学生,提供社交化的课程管理、资源共享、合作实验、协同研究。"
|
|
|
|
fp.page_type = "course"
|
|
|
|
fp.sort_type = 1
|
2014-07-31 13:40:02 +08:00
|
|
|
fp.save(:validate => false)
|
2014-07-19 16:41:29 +08:00
|
|
|
else
|
|
|
|
fp = course_fps.first
|
|
|
|
fp.web_title = "Trustie - 为大学生技术创新筑巢"
|
|
|
|
fp.title = "Trustie在线课程实践平台"
|
|
|
|
fp.description = "面向中国高校教师与大学生,提供社交化的课程管理、资源共享、合作实验、协同研究。"
|
|
|
|
fp.page_type = "course"
|
|
|
|
fp.sort_type = 1
|
2014-07-31 13:40:02 +08:00
|
|
|
fp.save(:validate => false)
|
2014-07-19 16:41:29 +08:00
|
|
|
end
|
|
|
|
contest_fps = FirstPage.where("page_type = 'contest'")
|
|
|
|
if contest_fps.nil? || contest_fps.first.nil?
|
|
|
|
fp1 = FirstPage.new
|
|
|
|
fp1.web_title = "Trustie - 为大学生技术创新筑巢"
|
|
|
|
fp1.title = "Trustie在线竞赛实战平台"
|
|
|
|
fp1.description = "面向中国大学生与编程爱好者,提供社交化的竞赛管理、应用管理、代码托管、合作交流。"
|
|
|
|
fp1.page_type = "contest"
|
|
|
|
fp1.sort_type = 1
|
2014-07-31 13:40:02 +08:00
|
|
|
fp1.save(:validate => false)
|
2014-07-19 16:41:29 +08:00
|
|
|
else
|
|
|
|
fp1 = contest_fps.first
|
|
|
|
fp1.web_title = "Trustie - 为大学生技术创新筑巢"
|
|
|
|
fp1.title = "Trustie在线竞赛实战平台"
|
|
|
|
fp1.description = "面向中国大学生与编程爱好者,提供社交化的竞赛管理、应用管理、代码托管、合作交流。"
|
|
|
|
fp1.page_type = "contest"
|
|
|
|
fp1.sort_type = 1
|
2014-07-31 13:40:02 +08:00
|
|
|
fp1.save(:validate => false)
|
2014-07-19 16:41:29 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|