diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 43a49c7d9..0697f0d0a 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -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| diff --git a/db/migrate/20160126031857_add_is_copy_to_course.rb b/db/migrate/20160126031857_add_is_copy_to_course.rb new file mode 100644 index 000000000..f60914bbd --- /dev/null +++ b/db/migrate/20160126031857_add_is_copy_to_course.rb @@ -0,0 +1,5 @@ +class AddIsCopyToCourse < ActiveRecord::Migration + def change + add_column :courses, :is_copy, :integer, :default => 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 736ce0f4e..42a5ea702 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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|