修改edit界面无法找到的问题
This commit is contained in:
parent
3cdda2a60a
commit
f316f43d6d
|
@ -1,15 +1,16 @@
|
|||
class ExerciseController < ApplicationController
|
||||
layout "base_courses"
|
||||
|
||||
before_filter :find_exercise_and_course, :only => [:create_exercise_question]
|
||||
before_filter :find_course, :only => [:index,:new,:create,:student_exercise_list,:edit]
|
||||
before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit]
|
||||
before_filter :find_course, :only => [:index,:new,:create,:student_exercise_list]
|
||||
|
||||
def index
|
||||
# remove_invalid_exercise(@course)
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||
if @is_teacher
|
||||
exercises = @course.exercises
|
||||
else
|
||||
exercises = @course.exercises.where(:exercise_status => 1)
|
||||
exercises = @course.exercises.where(:exercise_status => 2)
|
||||
end
|
||||
@exercises = paginateHelper exercises,20 #分页
|
||||
respond_to do |format|
|
||||
|
@ -46,7 +47,7 @@ class ExerciseController < ApplicationController
|
|||
:time => Time.now,
|
||||
:end_time => Time.now,
|
||||
:publish_time => Time.now,
|
||||
:polls_description => ""
|
||||
:exercise_description => ""
|
||||
}
|
||||
@exercise = Exercise.create option
|
||||
if @exercise
|
||||
|
@ -230,6 +231,10 @@ class ExerciseController < ApplicationController
|
|||
end
|
||||
|
||||
private
|
||||
def remove_invalid_exercise
|
||||
excercises = @course.exercises
|
||||
end
|
||||
|
||||
def find_exercise_and_course
|
||||
@exercise = Exercise.find params[:id]
|
||||
@course = Course.find @exercise.course_id
|
||||
|
|
Loading…
Reference in New Issue