MartinVolerich

MartinVolerich

Define_calculation incompatibility

I am loving the new Ash Framework beta book (and highly recommend it to all). There is so much great material in it and I am enjoying all of the time I spending with it.

Thank you Rebecca & Zach for writing it.

I’m working in Chapter 7 about “all things testing” and am on page 184, where you are discussing testing calculations and make use of the define_calculation DSL.

The issue I have come across is that this doesn’t seem to be compatible with the AshPhoenix module - included as an extension at the top of the Music domain module.

It seems to expect there to be an :action key on the definition in the domain.

It errors at line 93 in ash_phoenix.ex:

defp add_form_interface(interface, dsl_state, resource, resource? \\ false) do
  name = :"form_to_#{interface.name}"

  action =
    if resource? do
      Ash.Resource.Info.action(dsl_state, interface.action || interface.name)
    else
  --->>>>    Ash.Resource.Info.action(resource, interface.action || interface.name)
    end

Clearly, the definition of the calculation in the domain doesn’t need/know the action.

Please let me know if I can help further with this.

Thanks again
Martin

Most Liked

zachdaniel

zachdaniel

Creator of Ash

I’ve fixed this and released a new version of ash_phoenix v2.1.16. You can mix deps.update ash_phoenix to get the fix.

Where Next?

Popular in Questions Top

ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

Other popular topics Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44139 214
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement