From f7357f30ce3f9f32f2f94f58d8625e4c825a00e7 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Thu, 23 Mar 2017 05:03:58 -0400 Subject: [PATCH] Update payments_controller.rb --- app/controllers/payments_controller.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/controllers/payments_controller.rb b/app/controllers/payments_controller.rb index 290281a..cd1894d 100644 --- a/app/controllers/payments_controller.rb +++ b/app/controllers/payments_controller.rb @@ -12,8 +12,8 @@ class PaymentsController < ApplicationController include AuthHelper - before_filter :find_project, User.current.allowed_to?(:add_paypments, @project) - + before_filter :check_permissions + def new @payment = Payment.new @@ -32,14 +32,13 @@ class PaymentsController < ApplicationController else flash[:error] = @payment.errors.full_messages.to_sentence redirect_to new_customer_path -end + end end private - def find_project - # @project variable must be set before calling the authorize filter - @project = Project.find(params[:project_id]) + def check_permissions + return User.current.allowed_to?(:add_paypments, Project.find(params[:project_id])) end def only_one_non_zero?( array )