   end
 
   defp invalid_slug(conn) do
-    IO.puts"\n\n\n\ninvalid\n\n\n\n"
     conn
     |> put_flash(:error, "404")
     |> redirect(to: page_path(conn, :index))

      user
      |> build_assoc(:slugs)
      |> Slug.changeset(params)
    case params do
      %{"value"=>value} ->
          user_changeset = Ecto.Changeset.cast(user,%{"active_slug"=> value},[:active_slug],[])
    end


    multi =
    Ecto.Multi.new
    |>Ecto.Multi.insert(:slug, slug_changeset)
    |>Ecto.Multi.update(:user, user_changeset)

  end

  def update(conn, %{"id" => id}) do
    slug = Repo.get!(assoc(conn.assigns[:user], :slugs), id)
    changeset = Ecto.Changeset.cast(conn.assigns[:current_user], %{active_slug: slug.value}, [:active_slug])
    case Repo.update(changeset) do
