Ash Framework

AF

Ash Framework

The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.

Join

support

showcase

today-i-learned

Tell me a story

TIL at Goatmire Elixir from 🐐 ‘Tell me a story’ Spoiler alert: You need to know this but you also should see/hear in person so don’t read on if you will see/hear Sasa Juric’s ‘Tell me a story soon’...
No description

Mnesia Configuration Tunez example

```elixir alias Ash.DataLayer.Mnesia :mnesia.create_schema([node()]) Mnesia.start(Tunez.Music, [Tunez.Music.Artist])...

usage-rules.md for AI-assisted developement

This is a really great pattern! I deleted my mix.lock to make sure all of my Ash dependencies were updated to the latest version and pickup those sweet sweet usage rules. I'm really glad to see how the Elixir community is making great strides with regards to AI-assisted development. Didn't quite have the chance to see it in action yet, but I do love the idea!...

Resource vs Record

Resource: The module Record: The %Resource{} struct...

Learn macro -- day01: how to define macro `break`

macro is defined as ```elixir defmodule Macros.Loop do defmacro while(expression, do: block) do quote do...

G on hexdocs

TIL from Wojtek's Rapid Prototyping in Elixir talk that pressing g on hexdocs enables searching packages he also said:
you kinda have to know what you're looking for, that is going to change perhaps, stay tuned
I think he is hinting on some AI suggestion feature. 😄 ...
No description

Notifications don't send for bulk actions by default

When you do a single record action, notifications are published by default. However, when you do bulk actions, notifications are not published by default. If you want notifications published for bulk actions, you have to add bulk_options: [notify?: true] To avoid putting it on all call sites, you can set this as a default option on your Domain's code interface function opts....

`after` isn't just for `try`

```elixir defmodule RunAfter do def without_even_trying do raise "oops" after...

Setting the default foreign key type in Ash!

The default foreign key type is :uuid, and you can change it with attribute_type on a relationship, eg.
belongs_to :class, MyApp.Characters.Class, attribute_type: :integer
belongs_to :class, MyApp.Characters.Class, attribute_type: :integer
...

Comp is an Ash module for comparing stuff

iex> Comp.equal?("frEd", Ash.CiString.new("freD")) true...

_ in Integer, Float

```elixir iex> 1_000 1000 iex> 1_000.0 1000.0...

Comparing Durations....

Wasn't today but have been working on adding :duration, Ash.Type.Duration to Ash as want it for my AshNeo4j datalayer, etc., and learned that while Durations can be added and subtracted, they aren't so easy to compare, particularly when larger inability to compare weeks and months without a reference instant. So we don't have a comparator on Durations, although durations small enough to convert to timeout (with Kernel to_timeout) can be. That said durations are really useful in expressions, in Ash we've added support so they can be added/subtracted from temporal types DateTime|Date|Time|NaiveDateTime which uses the respective shift, (subtract also uses Duration.negate()), with the result the same temporal type. Durations can be added and subtracted with result in duration. Durations can also be negated....

About the `matches/1` builtin check. I completely forgot about it.

Thanks @Vonagam 😆 Added a year ago. ```elixir authorize_if matches("bar is even", fn _actor, context -> rem(context.changeset.arguments.bar, 2) == 0...

TIL that liveviews can share their assigns with nested liveviews

But only if the nested liveview isn't sticky! This is an optimization technique and shouldn't be relied on, but it's still pretty neat I think. https://hexdocs.pm/phoenix_live_view/1.0.9/Phoenix.Component.html#assign_new/3-when-connected...