trustieforge/db/migrate/20140801034242_change_board...

21 lines
573 B
Ruby

# -*coding:utf-8 -*-
class ChangeBoardsName < ActiveRecord::Migration
def up
boards = Board.where("project_id <> -1 and name like '%课程讨论区%'")
boards.each do |board|
board.name = "项目讨论区"
board.description = "项目讨论区"
board.save(:validate => false)
end
end
def down
boards = Board.where("project_id <> -1 and name like '%项目讨论区%'")
boards.each do |board|
board.name = " 课程讨论区"
board.description = " 课程讨论区"
board.save(:validate => false)
end
end
end