Back to Entries
Tags: ruby elixir code
Status: release
Date: 2023-02-19

Elixir Notes & Commands


Assuming your Repo and User are aliased, this command returns a count of users:

Aliased, like:

NameOfProject.Repo

NameOfProject.Accounts.User

Returning a count of users:

Repo.aggregate(User, :count, :id)

This is the same as User.count in Ruby/Rails.