diff options
author | marcin mikołajczak <git@mkljczk.pl> | 2022-06-01 16:03:22 +0200 |
---|---|---|
committer | marcin mikołajczak <git@mkljczk.pl> | 2022-06-01 16:03:22 +0200 |
commit | 5846e7d5f6b91ab63270f2104543d874589d39ca (patch) | |
tree | 3d1195e0fc2a3ed730dd61d5b4c465d3e4fa22ad /lib | |
parent | 0ecd6ba35e868eac296b013f743d82a120dd68db (diff) | |
download | pleroma-5846e7d5f6b91ab63270f2104543d874589d39ca.tar.gz pleroma-5846e7d5f6b91ab63270f2104543d874589d39ca.zip |
Use Repo.exists?
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/rule.ex | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/pleroma/rule.ex b/lib/pleroma/rule.ex index 611e945b3..c8e3470c7 100644 --- a/lib/pleroma/rule.ex +++ b/lib/pleroma/rule.ex @@ -37,7 +37,10 @@ defmodule Pleroma.Rule do def get(id), do: Repo.get(__MODULE__, id) - def exists?(id), do: not is_nil(get(id)) + def exists?(id) do + from(r in __MODULE__, where: r.id == ^id) + |> Repo.exists?() + end def create(params) do {:ok, rule} = |