Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
Don't require work_item_state params on GET. Return 404, before check…
Browse files Browse the repository at this point in the history
…ing Pundit, if object not found.
  • Loading branch information
diamondap committed Sep 12, 2016
1 parent 1535dd0 commit d774e35
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/controllers/work_item_states_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def update
end

def show
if @state_item.nil?
render nothing: true, status: :not_found and return
end
authorize @state_item
respond_to do |format|
format.json { render json: @state_item.serializable_hash }
Expand All @@ -41,7 +44,11 @@ def init_from_params
end

def work_item_state_params
params.require(:work_item_state).permit(:work_item_id, :action, :state)
if request.method == 'GET'
params.require(:work_item_id)
else
params.require(:work_item_state).permit(:work_item_id, :action, :state)
end
end

def params_for_update
Expand Down

0 comments on commit d774e35

Please sign in to comment.