Skip to content

Commit

Permalink
Merge pull request sparc-request#268 from bmic-development/sj-hotfix_…
Browse files Browse the repository at this point in the history
…for_approvals

approvals were broken by rails 5, strong params were needed [#145359963]
  • Loading branch information
Stuart-Johnson committed May 12, 2017
2 parents e103086 + fdbd590 commit bab9e78
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/controllers/dashboard/approvals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@ def new

def create
@sub_service_request = SubServiceRequest.find(params[:ssr_id])
if @sub_service_request.update_attributes(params[:sub_service_request])
@sub_service_request.generate_approvals(@user, params[:sub_service_request])
if @sub_service_request.update_attributes(approval_params[:sub_service_request])
@sub_service_request.generate_approvals(@user, approval_params[:sub_service_request])
@service_request = @sub_service_request.service_request
@approvals = [@service_request.approvals, @sub_service_request.approvals].flatten
flash[:success] = 'Approval Submitted!'
else
@errors = @sub_service_request.errors
end
end


private

def approval_params
params.permit(:ssr_id, sub_service_request: [:nursing_nutrition_approved, :lab_approved, :imaging_approved, :committee_approved])
end
end

0 comments on commit bab9e78

Please sign in to comment.