Use plain params-hash instead of custom helper
for deserialization of create/update-data
This commit is contained in:
parent
2f828542ef
commit
32c012af32
|
|
@ -24,8 +24,4 @@ class ApplicationController < ActionController::API
|
|||
]
|
||||
}, status: :forbidden
|
||||
end
|
||||
|
||||
def deserialize_params(opts)
|
||||
ActiveModelSerializers::Deserialization.jsonapi_parse(params, opts)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -28,6 +28,6 @@ class MatchScoresController < ApplicationController
|
|||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def match_score_params
|
||||
deserialize_params only: %i[points]
|
||||
params.require(:match_score).permit(:points)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
class MatchesController < ApplicationController
|
||||
# GET /matches/1
|
||||
def show
|
||||
render json: Match.find(params[:id]), include: ['match_scores.points', 'match_scores.team'], status: status
|
||||
render json: Match.find(params[:id]), include: ['match_scores.points', 'match_scores.team']
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,6 +26,6 @@ class TeamsController < ApplicationController
|
|||
end
|
||||
|
||||
def team_params
|
||||
deserialize_params only: %i[name]
|
||||
params.require(:team).permit(:name)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -48,6 +48,6 @@ class TournamentsController < ApplicationController
|
|||
end
|
||||
|
||||
def tournament_params
|
||||
deserialize_params only: %i[name description public teams]
|
||||
params.require(:tournament).permit(:name, :description, :public, :teams)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue