mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
fix: ensure calculation compiled
This commit is contained in:
parent
247abbb833
commit
0b8b704e2c
3 changed files with 1 additions and 9 deletions
|
@ -76,6 +76,7 @@ defmodule Ash.Actions.Sort do
|
|||
|
||||
calc = Ash.Resource.Info.calculation(resource, field) ->
|
||||
{module, opts} = calc.calculation
|
||||
Code.ensure_compiled(module)
|
||||
|
||||
if :erlang.function_exported(module, :expression, 2) do
|
||||
if Ash.DataLayer.data_layer_can?(resource, :expression_calculation_sort) do
|
||||
|
|
|
@ -2,12 +2,6 @@ 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] || %{})
|
||||
|
|
|
@ -10,9 +10,6 @@ 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.
|
||||
|
|
Loading…
Reference in a new issue