personal-selected_course/app/controllers/admin/selected_course_semesters_c...

43 lines
1.1 KiB
Ruby

class Admin::SelectedCourseSemestersController < OrbitMemberController
def index
end
def new
@selected_course_semester = SelectedCourseSemester.new
@url = admin_selected_course_semesters_path
end
def edit
@selected_course_semester = SelectedCourseSemester.find(params[:id])
@url = admin_selected_course_semester_path(@selected_course_semester)
end
def create
selected_course_semester = SelectedCourseSemester.create(course_semester_params)
@selected_course_semesters = SelectedCourseSemester.all
end
def update
selected_course_semester = SelectedCourseSemester.find(params[:id]) rescue nil
if !selected_course_semester.nil?
selected_course_semester.update_attributes(course_semester_params)
end
@selected_course_semesters = SelectedCourseSemester.all
end
def destroy
selected_course_semester = SelectedCourseSemester.find(params[:id]) rescue nil
if !selected_course_semester.nil?
selected_course_semester.destroy
end
@selected_course_semesters = SelectedCourseSemester.all
end
private
def course_semester_params
params.require(:selected_course_semester).permit!
end
end