diff --git a/lib/apartmentex/prefix_builder.ex b/lib/apartmentex/prefix_builder.ex index 489c3fc..2354886 100644 --- a/lib/apartmentex/prefix_builder.ex +++ b/lib/apartmentex/prefix_builder.ex @@ -1,20 +1,12 @@ defmodule Apartmentex.PrefixBuilder do @schema_prefix Application.get_env(:apartmentex, :schema_prefix) || "tenant_" - def build_prefix(tenant) when is_integer(tenant) do - @schema_prefix <> Integer.to_string(tenant) - end - - def build_prefix(tenant) when is_binary(tenant) do - @schema_prefix <> tenant - end - + def build_prefix(tenant) when is_integer(tenant), do: @schema_prefix <> Integer.to_string(tenant) + def build_prefix(tenant) when is_binary(tenant), do: @schema_prefix <> tenant def build_prefix(tenant) do cond do - is_binary(tenant.id) -> - @schema_prefix <> tenant.id - is_integer(tenant.id) -> - @schema_prefix <> Integer.to_string(tenant.id) + is_binary(tenant.id) -> build_prefix(tenant.id) + is_integer(tenant.id) -> build_prefix(tenant.id) end end end