To clarify - in your photo controller’s create action:
def create(conn, %{"product_id" => product_id, "photo" => photo_params}) do
product = Jordaniva.Inventory.get_product!(product_id)
case Gallery.create_photo(photo_params) do
{:ok, _photo} ->
conn
|> put_flash(:info, "Photo created successfully.")
|> redirect(to: Routes.photo_path(conn, :index))
{:error, %Ecto.Changeset{} = changeset} ->
# The 200 status code in your log shows the code goes down this path
# Because otherwise the response would be a 302 status code
#
# Let's see what the changeset can tell us:
IO.inspect(changeset, label: "create_photo changeset")
render(conn, "new.html", changeset: changeset)
end
end






















