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.
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.
I dug in a bit further and looked at the current implementation 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 or the implementing pull request.
A Perfect terminal with Zsh, Antidote, Oh My Zsh, Powerlevel10k, and Mise.
Find or Create Records with Preset Attributes using create_with
Join the conversation