al13ntown/app/controllers/profiles_controller.rb

61 lines
1.1 KiB
Ruby
Raw Normal View History

2026-08-24 20:12:41 +00:00
class ProfilesController < ApplicationController
#class MembersController < ApplicationController
before_action :authenticate_user!, only: [:edit, :update]
allow_unauthenticated_access(only: %i[index show])
def index
#@members = Member.all
end
def blogs
@blog = Blog.all
end
def edit
@profile = Profile.find(params[:id])
end
def new
@profile = current_user.profiles.new
end
def update
@profile = Profile.find(params[:id])
if @profile.update(profile_params)
redirect_to @profile
else
render :edit
end
end
#def create
# @member = current_user.members.new(member_params)
# if @member.save
# redirect_to @member
# else
# redirect_to root_path
# end
#end
#def destroy
# @profile = Member.find(params[:id])
# @member.destroy
# redirect_to member_path(@member), notice: "Member deleted."
#end
def show
@profile = Profile.find_by(id: params[:id])
if @profile.nil?
flash[:alert] = "serenity borked it"
redirect_to root_path
return
end
end
end
private
def profile_params
params.require(:profile).permit(:name, :bio, :age, :pronouns, :interests, :avatar_image )
end