Skip to content

Commit a3fc3a2

Browse files
committed
POST: ActiveModel::Api today i learned
1 parent 1ab9889 commit a3fc3a2

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

_posts/2025/2025-11-06-a-perfect-terminal-with-zsh-antidote-on-my-zsh-powerlevel10k-mise.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: post
33
title: A Perfect terminal with Zsh, Antidote, Oh My Zsh, Powerlevel10k, and Mise.
44
categories:
5-
- tutorial
5+
- tutorials
66
tags:
77
- zsh
88
- terminal
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
layout: post
3+
title: Use ActiveModel::Api for a Bare Bones Action Model interface
4+
categories:
5+
- today-i-learned
6+
tags:
7+
- ruby on rails
8+
---
9+
10+
Today, I learned that **ActiveModel::Api** is the minimal implementation for an object to act like a model. **ActiveModel::Model** was the standard prior to Rails 7. You can still use it but it implies additional model-esque functionality where as API is the bare bones interface.
11+
12+
<!--excerpt-->
13+
14+
> Includes the required interface for an object to interact with Action Pack and Action View, using different Active Model modules. It includes model name introspections, conversions, translations, and validations. Besides that, it allows you to initialize the object with a hash of attributes, pretty much like Active Record does.
15+
>
16+
> - [api.rubyonrails.org](https://api.rubyonrails.org/classes/ActiveModel/API.html)
17+
18+
I dug in a bit further and looked at the [current implementation](https://github.com/rails/rails/blob/9f466dd9d4672d7dc6c49a7861d9e30eff69c163/activemodel/lib/active_model/model.rb#L45) for **ActiveModel::Model** and it looks like the only current difference is the addition of the **ActiveModel::Access** module. For more information see the [full documentation](https://api.rubyonrails.org/classes/ActiveModel/API.html) or the [implementing pull request](https://github.com/rails/rails/pull/43223).

0 commit comments

Comments
 (0)