   end
 
   def update(conn, %{"id" => id}) do
-    IO.puts("\n\nactivating\n\n")
     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

  end

  def create(conn, %{"slug"=>params}) do

    IO.puts inspect params

    case Repo.transaction(new_slug(conn.assigns[:user], params)) do
      {:ok, %{user: user, slug: _slug}} ->
        conn

      user
      |> build_assoc(:slugs)
      |> Slug.changeset(params)

    user_changeset = Ecto.Changeset.cast(user,%{"active_slug"=> params.value},[:active_slug],[])

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