mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-02-13 21:33:20 +01:00
32 lines
646 B
Ruby
32 lines
646 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ListsController < ApplicationController
|
|
before_action :authenticate_user!
|
|
before_action :set_user, only: %i[index]
|
|
|
|
def index
|
|
@lists = List.where(user: current_user)
|
|
end
|
|
|
|
def destroy
|
|
@list = List.find(params[:id])
|
|
|
|
@list.destroy
|
|
|
|
respond_to do |format|
|
|
format.turbo_stream do
|
|
render turbo_stream: turbo_stream.remove("list_#{params[:id]}")
|
|
end
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def set_user
|
|
@user = User.where("LOWER(screen_name) = ?", params[:username].downcase).includes(:profile).first!
|
|
end
|
|
|
|
def list_params
|
|
params.require(:list).permit(:name)
|
|
end
|
|
end
|