Make sure Cancancan actually finds the resource to authorize it

This commit is contained in:
Tom Naessens 2019-05-31 12:45:49 +12:00
parent 13bf57d132
commit 756cd09fa5

View file

@ -2,7 +2,7 @@ class RequestsController < ApplicationController
load_and_authorize_resource :user, find_by: :name load_and_authorize_resource :user, find_by: :name
before_action :load_request, only: [:confirm, :decline] before_action :load_request, only: [:confirm, :decline]
authorize_resource :request, only: [:confirm, :decline] authorize_resource :request, id_param: :request_id, only: [:confirm, :decline]
def index def index
@requests = @user.incoming_requests.group_by(&:status) @requests = @user.incoming_requests.group_by(&:status)