zachdaniel

zachdaniel

Creator of Ash

Support for to-one relationship paths in calculations has been merged

Hey friends! A long time quality of life feature we’ve been wanting to add is the ability to refer to to-one relationships in calculations. Since an example is worth a thousand words, lets see how you would have had to refer to to-one related information in a calculation before:

The old way

Using a named aggregate

aggregates do
  # add a `first` aggregate
  first :authors_first_name, :authors, :first_name 
end

calculations do
  # refer to that in a calculation
  calculate :some_calculation, :string, expr(authors_first_name ...)
end

Using in-line aggregates

# use an in-line first aggregate
calculate :some_calculation, :string, expr(first(author, field: :first_name))

The new way

The old ways will continue to work, but you can now use to-one path relationships directly in your calculations. You can’t use to-many relationships in a calculation, i.e posts.text in a calculation, because which post are you referring to?

calculate :some_calculation, :string, expr(author.first_name ...)

Hopefully this will make writing certain kinds of calculations much simpler :slight_smile:

Where Next?

Popular in News & Updates Top

martosaur
InstructorLite - v1.1.1 and v1.1.2 Pass Gemini token in request header rather than in request parameter (as is shown in API reference :...
New
fhunleth
We recently released Nerves 1.4.0 and an update to the Nerves new project generator, nerves_bootstrap. The biggest change is support for ...
New
mobileoverlord
New versions of the Kiosk systems are out. These systems update official Nerves systems with a local web browser for rendering user inter...
New
fhunleth
We recently released Nerves 1.6 and corresponding updates to the Nerves new project generator, nerves_bootstrap and our official systems....
New
zachdaniel
Hey folks, made some recent performance improvements to spark, the tool underlying all of our DSLs. GitHub - ash-project/spark: Tooling f...
New
jjcarstens
I know you might be thinking ¬ “Why make another SSH daemon wrapper when there already exists many like sshex and esshd??” Well, grea...
New
fhunleth
I wanted to let everyone know that the Erlang Ecosystem Foundation (EEF) has a working group dedicated to embedded systems and IoT. We ha...
New
jjcarstens
NervesPack 0.4.0 is a minor bump with a fairly big change. This update drops :nerves_firmware_ssh in favor of the newer and more focused...
New
fhunleth
We’re excited to announce that we’re actively working on NervesHub 2.0, an improved version of our IoT device firmware update and managem...
New
zachdaniel
The new Ash Framework site and installer are live. Please try it out and let me know what you think!
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3268 119930 1237
New
William
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
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
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New

We're in Beta

About us Mission Statement