personal-course/app/controllers/admin/course_semesters_controller.rb

43 lines
915 B
Ruby
Raw Normal View History

2015-12-29 11:35:44 +00:00
class Admin::CourseSemestersController < OrbitMemberController
def index
end
def new
@course_semester = CourseSemester.new
@url = admin_course_semesters_path
end
def edit
@course_semester = CourseSemester.find(params[:id])
@url = admin_course_semester_path(@course_semester)
end
def create
course_semester = CourseSemester.create(course_semester_params)
@course_semesters = CourseSemester.all
end
def update
course_semester = CourseSemester.find(params[:id]) rescue nil
if !course_semester.nil?
course_semester.update_attributes(course_semester_params)
end
@course_semesters = CourseSemester.all
end
def destroy
course_semester = CourseSemester.find(params[:id]) rescue nil
if !course_semester.nil?
course_semester.destroy
end
@course_semesters = CourseSemester.all
end
private
def course_semester_params
params.require(:course_semester).permit!
end
end