picture cache for forms

This commit is contained in:
2023-01-22 20:40:28 +02:00
parent 0a9b32f06b
commit e4364fc677
7 changed files with 16 additions and 83 deletions

View File

@ -1,28 +1,23 @@
class ProfilesController < ApplicationController
before_action :set_profile, only: %i[ show edit update destroy ]
# GET /profiles
def index
@profiles = Profile.page params[:page]
end
# GET /profiles/1
def show
end
# GET /profiles/new
def new
kind = params[:kind]
kind = Profile.kinds.first unless Profile.kinds.include?(kind)
@profile = Profile.new kind: kind
end
# GET /profiles/1/edit
def edit
authorize @profile
end
# POST /profiles
def create
@profile = Profile.new(profile_params)
@profile.member = current_member
@ -34,7 +29,6 @@ class ProfilesController < ApplicationController
end
end
# PATCH/PUT /profiles/1
def update
authorize @profile
if @profile.update(profile_params)
@ -44,7 +38,6 @@ class ProfilesController < ApplicationController
end
end
# DELETE /profiles/1
def destroy
authorize @profile
@profile.destroy
@ -59,6 +52,6 @@ class ProfilesController < ApplicationController
# Only allow a list of trusted parameters through.
def profile_params
params.require(:profile).permit(:name, :bio, :picture, :kind)
params.require(:profile).permit(:name, :bio, :picture,:picture_cache, :kind)
end
end