课程添加is_copy属性

This commit is contained in:
cxt 2016-01-26 15:05:45 +08:00
parent 520811fdc7
commit 19003f27fc
3 changed files with 11 additions and 2 deletions

View File

@ -441,7 +441,10 @@ class CoursesController < ApplicationController
@course = cs.create_course(params,User.current)[:course]
if params[:copy_course]
copy_course = Course.find params[:copy_course].to_i
@course.update_attributes(:open_student => copy_course.open_student, :publish_resource => copy_course.publish_resource)
@course.is_copy = 1
@course.open_student = copy_course.open_student
@course.publish_resource = copy_course.publish_resource
@course.save
if params[:checkAll]
attachments = copy_course.attachments
attachments.each do |attachment|

View File

@ -0,0 +1,5 @@
class AddIsCopyToCourse < ActiveRecord::Migration
def change
add_column :courses, :is_copy, :integer, :default => 0
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160126024429) do
ActiveRecord::Schema.define(:version => 20160126031857) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -501,6 +501,7 @@ ActiveRecord::Schema.define(:version => 20160126024429) do
t.string "end_term"
t.integer "is_excellent", :default => 0
t.integer "excellent_option", :default => 0
t.integer "is_copy", :default => 0
end
create_table "custom_fields", :force => true do |t|