From 9f725398454131a25b0377efda86995ce48dc348 Mon Sep 17 00:00:00 2001 From: cxt Date: Sun, 9 Oct 2016 16:11:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E7=89=88=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course.rb | 6 ++++-- app/views/courses/new.html.erb | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/course.rb b/app/models/course.rb index cc80a1b4b..13050ddbe 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -24,7 +24,7 @@ class Course < ActiveRecord::Base end end - attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name, :is_delete, :syllabus_id + attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name, :is_delete, :syllabus_id, :end_time, :end_term #belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表 belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表 @@ -96,7 +96,9 @@ class Course < ActiveRecord::Base 'class_period', 'open_student', 'is_delete', - 'syllabus_id' + 'syllabus_id', + 'end_time', + 'end_term' acts_as_customizable diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb index f754c4540..7ab0c75a9 100644 --- a/app/views/courses/new.html.erb +++ b/app/views/courses/new.html.erb @@ -39,8 +39,8 @@
  • - <%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"new_end_time"} %> - <%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"new_end_term"} %> + <%= select_tag :end_time,options_for_select(course_time_option(@course[:end_time]),@course[:end_time]), {:id=>"new_end_time"} %> + <%= select_tag :end_term,options_for_select(course_term_option,@course[:end_term] || cur_course_term),{:id=>"new_end_term"} %> 仅针对跨越多个学期的班级,否则与开始学期保持一致。