Ash FrameworkAF
Ash Framework3y ago
16 replies
Abhishek Tripathi

help with ash_geo for using locations.

Resource definition looks like

defmodule CompaniesRegEx.Resources.Recruiters do
  use Ash.Resource, data_layer: AshPostgres.DataLayer
  import AshGeo.Postgis


actions do
    defaults [:create, :read, :update, :destroy]

    action :create_loc do
      argument :location, :geo_any

      change set_attribute(:location, arg(:location))
    end

    read :containing do
      argument :location, :geo_any do
        allow_nil? false
        constraints geo_types: :point
      end

      filter expr(^st_within(^arg(:location), location))
    end
end


  attributes do
    # Add an autogenerated UUID primary key called `:id`.
    uuid_primary_key :id
    attribute :location, :geometry
  end

end


The error seems to be

Compiling 2 files (.ex)

== Compilation error in file lib/companies_reg_ex/resources/recruiters.ex ==
** (CompileError) lib/companies_reg_ex/resources/recruiters.ex:34: undefined function change/1 (there is no such import)
    (ash 2.13.2) expanding macro: Ash.Resource.Dsl.Actions.Action.action/2


when I add import Ash.Expr above, I get

(CompileError) lib/companies_reg_ex/resources/recruiters.ex:29: function expr/1 imported from both Ash.Filter.TemplateHelpers and Ash.Expr, call is ambiguous
Was this page helpful?