mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-11-14 04:52:17 +00:00
Use Repo.exists?
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
0ecd6ba35e
commit
5846e7d5f6
1 changed files with 4 additions and 1 deletions
|
@ -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} =
|
||||
|
|
Loading…
Reference in a new issue