From 9e0e9ea2ae1577ed41ba241c183d407c397f0354 Mon Sep 17 00:00:00 2001 From: shibao Date: Fri, 18 Feb 2022 18:49:11 -0500 Subject: [PATCH] fix ammo group create not handling invalid attrs --- lib/cannery/ammo.ex | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/cannery/ammo.ex b/lib/cannery/ammo.ex index 0ef918e..01b4e13 100644 --- a/lib/cannery/ammo.ex +++ b/lib/cannery/ammo.ex @@ -256,6 +256,12 @@ defmodule Cannery.Ammo do |> Repo.insert() end + def create_ammo_group(invalid_attrs, _user) do + %AmmoGroup{} + |> AmmoGroup.create_changeset(invalid_attrs |> Map.put("user_id", "-1")) + |> Repo.insert() + end + @doc """ Updates a ammo_group.