Oh great
. I thought Ash needed NodeJS by default. I am glad to see that’s not the case.
I’ve been meaning to do a write-up of all my Ash Multitenency learnings. I can tell you that Ash makes it much easier than in stock Elixir.
That would be really nice, I started evaluating Ash when version 3.0 was in Beta, decided to wait for it to become stable (it’s been a while since then) and now I want to give it another try; I never had experience with older versions, there are authentication and authorization aspects I’m particularly interested in, my use case is that each customer will create a main user account (a tenant) and this user will in turn add other users to his account who will be able to login with different access levels, it would be nice to hear from someone who already uses multi-tenancy even if their model is different, where to pay attention, what can go wrong, any insights would be very welcome.
Getting this error trying to setup the repo:
** (Mix) The database for Tunez.Repo couldn’t be created: ERROR XX000 (internal_error) template database “template1” has a collation version mismatch
hint: Rebuild all objects in the template database that use the default collation and run ALTER DATABASE template1 REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
The template database was created using collation version 2.38, but the operating system provides version 2.40.
What is the command to rebuild the objects in the template database? And what lib or application is being referred to as version 2.38 vs 2.40?
===========
Nevermind. Solved by following instructions here.
In case anyone is interested we are planning on running a book club on this book within the next couple of months, it will be headed by @stevensonmt
If anyone is interested please PM me or @stevensonmt and we will add you to the list.
We should have a few copies to give away as well so if you need a copy please let us know ![]()
just bought Ash and the Liveview book using the code
LFG!
Just bought the book and started reading it today. I must say I find it a really great resource for expanding my understanding of the Ash framework and that I look forward to the last chapters. ![]()
Thank you everyone! The reception has been great and I love hearing about people picking it up and reading it and the difference it has made in their understanding of Ash ![]()
Hi all.
I don’t understand the code at Chapter 16 of the ash framework book Chapter 6. Authorization: What Can You Do, page 162.
06/lib/tunez/accounts/user.ex
policies do
# ...
policy action(:read) do
authorize_if expr(id == ^actor(:id))
end
end
How can I reference the actor?
Is nowhere defined.
Thanks for your reply, Heiko
We’ve discussed this on discord, posting for others who have a similar question: these expressions are “templates”. More information can be found here: Expressions — ash v3.4.62
I’ve tried various ways of making the POST request to the json api in Chapter 4 but I keep getting a 406 unacceptable media type error. Any suggestions on what I might be doing wrong?
The APIs produced by ash_json_api are JSON:API spec compliant, described here: JSON:API — Latest Specification (v1.1). You need to supply a specific content type header, which is described there in that spec
application/vnd.api+json.
I think the header is set though:
iex(8)> Req.post("http://localhost:4000/api/json/artists", headers: ["content-type": "application/json"], json: %{"data" => %{"type" => "artist", "attributes" => %{"name" => "My New Artist", "biography" => "some content"}}})
{:ok,
%Req.Response{
status: 406,
headers: %{
"cache-control" => ["max-age=0, private, must-revalidate"],
"content-type" => ["application/vnd.api+json"],
"date" => ["Wed, 19 Feb 2025 18:18:45 GMT"],
"vary" => ["accept-encoding"],
"x-request-id" => ["GCWu5CBzLRfMtJUAAHyh"]
},
body: %{
"errors" => [
%{
"code" => "unacceptable_media_type",
"id" => "f2331603-19f4-4865-990a-169b0a7c68cc",
"meta" => %{},
"status" => "406",
"title" => "Unacceptable Media Type"
}
],
"jsonapi" => %{"version" => "1.0"}
},
trailers: %{},
private: %{}
}}
FWIW the response is the exact same (including the content type field) whether I include the headers: ["content-type" => "application/json"] in the request or not.
You’re using application/json ![]()
oh for pete’s sake. It’s even called out in the text. Sorry.
All good
it’s a weird/unexpected quirk of JSON:API ![]()
I got an email mentioning that the final version of the book has been released.
Congrats to @sevenseacat and @zachdaniel!
Thank you so much! ![]()
Just in time the Remote Elixir Book Club!
Exactly! We’re reading it now and our first discussion about it is in two weeks. @sevenseacat and @zachdaniel are very welcome to join our chats if they have time and interest. Absolutely no pressure intended!






















