chore: init commit
in worker.../repo/GITFOLDER.zip is the .git folder.
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class SchoolsController < ApplicationController
|
||||
before_action :set_school, only: %i[show edit update destroy]
|
||||
before_action :authenticate_user!
|
||||
|
||||
# GET /schools or /schools.json
|
||||
def index
|
||||
@schools = School.all
|
||||
end
|
||||
|
||||
# GET /schools/1 or /schools/1.json
|
||||
def show; end
|
||||
|
||||
# GET /schools/new
|
||||
def new
|
||||
@school = School.new
|
||||
end
|
||||
|
||||
# GET /schools/1/edit
|
||||
def edit; end
|
||||
|
||||
# POST /schools or /schools.json
|
||||
def create
|
||||
@school = School.new(school_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @school.save
|
||||
format.html { redirect_to school_url(@school), notice: t(".notice") }
|
||||
format.json { render :show, status: :created, location: @school }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_content }
|
||||
format.json { render json: @school.errors, status: :unprocessable_content }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /schools/1 or /schools/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @school.update(school_params)
|
||||
format.html { redirect_to school_url(@school), notice: t(".notice") }
|
||||
format.json { render :show, status: :ok, location: @school }
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_content }
|
||||
format.json { render json: @school.errors, status: :unprocessable_content }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /schools/1 or /schools/1.json
|
||||
def destroy
|
||||
@school.destroy!
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to schools_url, notice: t(".notice") }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_school
|
||||
@school = School.find(params.expect(:id))
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def school_params
|
||||
params.expect(school: [:name])
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user