diff --git a/mealapi/resources/mealresource.py b/mealapi/resources/mealresource.py index 9f79be5..ac3c7ff 100644 --- a/mealapi/resources/mealresource.py +++ b/mealapi/resources/mealresource.py @@ -16,9 +16,7 @@ class MealBaseResource(Resource): body = request.get_json() try: - mealobj = self.mealschema.load(body) - db.session.add(mealobj.data) - db.session.commit() + self.mealschema.load(body, session=db.session) return '', 204 except ValidationError as error: abort(406, error.messages)