now this is what i call an app

This commit is contained in:
Roscoe 2025-09-08 03:34:58 +01:00
commit 8063246b68
Signed by: RoscoeDaWah
SSH key fingerprint: SHA256:Hqn452XQ1ETzUt/FthJu6+OFkS4NBxCv5VQSEvuk7CE
97 changed files with 1989 additions and 0 deletions

View file

@ -0,0 +1,48 @@
class TapesController < ApplicationController
allow_unauthenticated_access only: %i[ index show ]
before_action :set_tape, only: %i[ show edit update destroy ]
def index
@tapes = Tape.all
end
def show
end
def new
@tape = Tape.new
end
def create
@tape = Tape.new(tape_params)
if @tape.save
redirect_to @tape
else
render :new, status: :unprocessable_entity
end
end
def edit
end
def update
if @tape.update(tape_params)
redirect_to @tape
else
render :edit, status: :unprocessable_entity
end
end
def destroy
@tape.destroy
redirect_to tapes_path
end
private
def set_tape
@tape = Tape.find(params[:id])
end
def tape_params
params.expect(tape: [ :title, :video ])
end
end