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 ![]()
Popular in News & Updates
We’ve released new versions of all of the officially maintained Nerves Systems. The official systems, nerves_system_rpi0, nerves_system_b...
New
It is my pleasure to announce the official release of the new generation of NervesHub with the v2.0.0 release.
Containers are tagged. :p...
New
Hologram v0.10 is out! The headline is the event system, which got a lot bigger this release. You can now handle keyboard, scroll, resize...
New
Hey folks! We’re starting a new weekly newsletter with the goings on of the various Ash packages and other interesting news from myself a...
New
We recently released Nerves 1.5.0 and corresponding updates to the Nerves new project generator, nerves_bootstrap and our official system...
New
This post introduces the new data features in Livebook 0.9: fast data exploration through integration with Explorer, interactive data tab...
New
Hello everyone!
We’ve got two big updates on the Ash community today :tada:
Discord Support Forum → Elixir Forum
The Ash community is g...
New
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
We have for you a new release candidate. Take :notes: if you use partitioned queues or make heavy use of Workflows. This is the RC for yo...
New
@jimsynz just launched an epic new extension for Ash! It allows you to create rich mix tasks for calling your resource actions directly f...
New
Other popular topics
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
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
Phoenix 1.4.0 released
Phoenix 1.4 is out! This release ships with exciting new features, most notably
with HTTP2 support, improved deve...
New
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Hi everyone,
One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
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
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors:
[WARN] - (starship::utils): Executing command ...
New
Hello everyone,
Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine)
This is a plugin that adds support for Elixir to JetBrains IntelliJ...
New
Hello!
Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









