2022-12-20 16:05:26 +01:00
|
|
|
class MembersController < ApplicationController
|
|
|
|
before_action :set_member, only: %i[ show edit update destroy ]
|
|
|
|
|
|
|
|
# GET /members
|
|
|
|
def index
|
2023-01-11 17:20:21 +01:00
|
|
|
@members = Member.order(:name).page params[:page]
|
2022-12-20 16:05:26 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
# GET /members/1
|
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
|
|
|
# GET /members/1/edit
|
|
|
|
def edit
|
|
|
|
end
|
|
|
|
|
|
|
|
# POST /members
|
|
|
|
def create
|
|
|
|
@member = Member.new(member_params)
|
|
|
|
|
|
|
|
if @member.save
|
|
|
|
redirect_to @member, notice: "Member was successfully created."
|
|
|
|
else
|
|
|
|
render :new, status: :unprocessable_entity
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# PATCH/PUT /members/1
|
|
|
|
def update
|
|
|
|
if @member.update(member_params)
|
|
|
|
redirect_to @member, notice: "Member was successfully updated."
|
|
|
|
else
|
|
|
|
render :edit, status: :unprocessable_entity
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# DELETE /members/1
|
|
|
|
def destroy
|
|
|
|
@member.destroy
|
|
|
|
redirect_to members_url, notice: "Member was successfully destroyed."
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
# Use callbacks to share common setup or constraints between actions.
|
|
|
|
def set_member
|
|
|
|
@member = Member.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
# Only allow a list of trusted parameters through.
|
|
|
|
def member_params
|
2023-01-22 19:29:10 +01:00
|
|
|
params.require(:member).permit(:name, :public, :bio , :picture,
|
|
|
|
:picture_cache , :arrived ,:left)
|
2022-12-20 16:05:26 +01:00
|
|
|
end
|
|
|
|
end
|