diff --git a/lib/ash/resource/calculation/expression.ex b/lib/ash/resource/calculation/expression.ex index 5773b9b5..dd542da6 100644 --- a/lib/ash/resource/calculation/expression.ex +++ b/lib/ash/resource/calculation/expression.ex @@ -2,6 +2,12 @@ defmodule Ash.Resource.Calculation.Expression do @moduledoc false use Ash.Calculation, type: :string + @doc false + # This exists to fix some very strange + # compile time errors, whereby Code.ensure_compiled(this_module) + # doesn't work, but calling a function on it does + def check, do: :ok + def expression(opts, context) do expr = Ash.Filter.build_filter_from_template(opts[:expr], nil, context, context[:context] || %{}) diff --git a/lib/ash/sort/sort.ex b/lib/ash/sort/sort.ex index 25a1287a..f6a0777e 100644 --- a/lib/ash/sort/sort.ex +++ b/lib/ash/sort/sort.ex @@ -10,6 +10,9 @@ defmodule Ash.Sort do alias Ash.Error.Query.{InvalidSortOrder, NoSuchAttribute} + # See the comment in that module for more on why this is here + Ash.Resource.Calculation.Expression.check() + @doc """ A utility for parsing sorts provided from external input. Only allows sorting on public attributes and aggregates.