hubfeenix.fi/app/controllers/members_controller.rb

52 lines
1.1 KiB
Ruby
Raw Normal View History

2022-12-20 16:05:26 +01:00
class MembersController < ApplicationController
2023-01-22 11:08:03 +01:00
before_action :set_member, only: %i[ show edit update destroy]
2022-12-20 16:05:26 +01:00
def index
2023-01-15 23:17:22 +01:00
@members = Member.page params[:page]
2022-12-20 16:05:26 +01:00
end
def show
end
def edit
end
2023-01-22 11:08:03 +01:00
def settings
@member = current_member
end
2022-12-20 16:05:26 +01:00
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
def update
if @member.update(member_params)
redirect_to @member, notice: "Member was successfully updated."
else
render :edit, status: :unprocessable_entity
end
end
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
2022-12-24 14:07:25 +01:00
params.require(:member).permit(:name, :public, :bio , :picture)
2022-12-20 16:05:26 +01:00
end
end