Tapes are now Clips, also they have categories

This commit is contained in:
Roscoe 2025-09-10 03:08:27 +01:00
commit c8732b6332
Signed by: RoscoeDaWah
SSH key fingerprint: SHA256:Hqn452XQ1ETzUt/FthJu6+OFkS4NBxCv5VQSEvuk7CE
41 changed files with 347 additions and 148 deletions

View file

@ -0,0 +1,48 @@
class ClipsController < ApplicationController
allow_unauthenticated_access only: %i[ index show ]
before_action :set_clip, only: %i[ show edit update destroy ]
def index
@clips = Clip.all
end
def show
end
def new
@clip = Clip.new
end
def create
@clip = Clip.new(clip_params)
if @clip.save
redirect_to @clip
else
render :new, status: :unprocessable_entity
end
end
def edit
end
def update
if @clip.update(clip_params)
redirect_to @clip
else
render :edit, status: :unprocessable_entity
end
end
def destroy
@clip.destroy
redirect_to clips_path
end
private
def set_clip
@clip = Clip.find(params[:id])
end
def clip_params
params.expect(clip: [ :title, :video, :category_id ])
end
end