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
|
}, status: :forbidden
|
||||||
end
|
end
|
||||||
|
|
||||||
def deserialize_params(opts)
|
|
||||||
ActiveModelSerializers::Deserialization.jsonapi_parse(params, opts)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,6 @@ class MatchScoresController < ApplicationController
|
||||||
|
|
||||||
# Only allow a trusted parameter "white list" through.
|
# Only allow a trusted parameter "white list" through.
|
||||||
def match_score_params
|
def match_score_params
|
||||||
deserialize_params only: %i[points]
|
params.require(:match_score).permit(:points)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,6 @@
|
||||||
class MatchesController < ApplicationController
|
class MatchesController < ApplicationController
|
||||||
# GET /matches/1
|
# GET /matches/1
|
||||||
def show
|
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
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,6 @@ class TeamsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def team_params
|
def team_params
|
||||||
deserialize_params only: %i[name]
|
params.require(:team).permit(:name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,6 @@ class TournamentsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def tournament_params
|
def tournament_params
|
||||||
deserialize_params only: %i[name description public teams]
|
params.require(:tournament).permit(:name, :description, :public, :teams)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue