课程讨论区逻辑更改

This commit is contained in:
nwb 2014-06-03 11:52:44 +08:00
parent 7d3d406c00
commit 8460344043
2 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,13 @@
class AddBoardsTypeToBoards < ActiveRecord::Migration
def change
add_column :boards, :course_id, :int
Board.all.each do |board|
project = Project.find_by_id(board.project_id)
if project && project.project_type == 1
board.course_id = board.project_id
board.save
end
end
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140530102015) do ActiveRecord::Schema.define(:version => 20140603033360) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -119,6 +119,7 @@ ActiveRecord::Schema.define(:version => 20140530102015) do
t.integer "messages_count", :default => 0, :null => false t.integer "messages_count", :default => 0, :null => false
t.integer "last_message_id" t.integer "last_message_id"
t.integer "parent_id" t.integer "parent_id"
t.integer "course_id"
end end
add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id"