Use plain params-hash instead of custom helper

for deserialization of create/update-data
This commit is contained in:
Thor77 2018-12-11 14:57:07 +01:00
parent 2f828542ef
commit 32c012af32
5 changed files with 4 additions and 8 deletions

View File

@ -24,8 +24,4 @@ class ApplicationController < ActionController::API
]
}, status: :forbidden
end
def deserialize_params(opts)
ActiveModelSerializers::Deserialization.jsonapi_parse(params, opts)
end
end

View File

@ -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

View File

@ -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

View File

@ -26,6 +26,6 @@ class TeamsController < ApplicationController
end
def team_params
deserialize_params only: %i[name]
params.require(:team).permit(:name)
end
end

View File

@ -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