Sha256: 2c5bc1412466a4253cd8077caa0d93d11045e808293c46013eeaf41f0af083b2
Contents?: true
Size: 1.32 KB
Versions: 5
Compression:
Stored size: 1.32 KB
Contents
require_dependency "utfpr_gp_engine/application_controller" module UtfprGpEngine class StudentsController < ApplicationController before_action :set_student, only: [:show, :edit, :update, :destroy] # GET /students def index @students = Student.all end # GET /students/1 def show end # GET /students/new def new @student = Student.new end # GET /students/1/edit def edit end # POST /students def create @student = Student.new(student_params) if @student.save redirect_to @student, notice: 'Student was successfully created.' else render :new end end # PATCH/PUT /students/1 def update if @student.update(student_params) redirect_to @student, notice: 'Student was successfully updated.' else render :edit end end # DELETE /students/1 def destroy @student.destroy redirect_to students_url, notice: 'Student was successfully destroyed.' end private # Use callbacks to share common setup or constraints between actions. def set_student @student = Student.find(params[:id]) end # Only allow a trusted parameter "white list" through. def student_params params.require(:student).permit(:name) end end end
Version data entries
5 entries across 5 versions & 1 rubygems