mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
fix api/reservations#index find statistic_profile_id from the user_id because user_id is not a column of reservations table anymore
This commit is contained in:
parent
22d4d3a78a
commit
c49db3b512
@ -11,7 +11,10 @@ class API::ReservationsController < API::ApiController
|
||||
if params[:reservable_id] && params[:reservable_type] && params[:user_id]
|
||||
params[:user_id] = current_user.id unless current_user.admin?
|
||||
|
||||
@reservations = Reservation.where(params.permit(:reservable_id, :reservable_type, :user_id))
|
||||
where_clause = params.permit(:reservable_id, :reservable_type).to_h
|
||||
where_clause[:statistic_profile_id] = StatisticProfile.find_by!(user_id: params[:user_id])
|
||||
|
||||
@reservations = Reservation.where(where_clause)
|
||||
elsif params[:reservable_id] && params[:reservable_type] && current_user.admin?
|
||||
@reservations = Reservation.where(params.permit(:reservable_id, :reservable_type))
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user