Ash FrameworkAF
Ash Framework8mo ago
9 replies
andyl

Reusable Ash Resources

I've got a commonly-used Ash resource that I'd like to put in an Elixir package for reuse across Phoenix apps. Is anyone doing this? Can anyone point me towards examples or best practice?

This works, but the otp_app is hardcoded:
defmodule Packaged.Resource do
  use Ash.Resource, domain: Packaged.Domain, otp_app: :consumer_app 
end

This fails:
defmodule Packaged.Resource do
  use Ash.Resource, domain: Packaged.Domain, otp_app: Application.get_application(__MODULE__) 
end


Ash compilation seems to require static configuration for otp_app. Is that right?
Solution
that solved it for me. thanks again for the tips.
Was this page helpful?