73 words, 1 min read

Daily reminder that you can implement Inspect protocol for your Ecto / Ash models and actually see something in the logs 🙃

defmodule Postline.Accounts.User do
# This is where the magic happens
@derive {Inspect, only: [:id, :email, :first_name, :last_name]}
use Ecto.Schema
schema "users" do
field :email, :string
field :first_name, :string
field :last_name, :string
field :avatar, :string
field :subscribed, :boolean, default: false
field :subscription, :string
field :role, :atom, default: :user
timestamps()
end
end

source