Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce ActiveModel::API #43223

Merged
merged 1 commit into from
Sep 15, 2021
Merged

Introduce ActiveModel::API #43223

merged 1 commit into from
Sep 15, 2021

Conversation

p8
Copy link
Member

@p8 p8 commented Sep 15, 2021

Summary

Currently ActiveModel::Model is defined as the minimum API to talk
with Action Pack and Action View.
However, its name suggests it can be included to create Active Record
type models. But for creating models it's probably too minimal. For
example it's very common to include ActiveModel::Attributes as well.

By moving ActiveModel::Model's implementation to a new
ActiveModel::API we keep a definition of the minimum API to talk with
Action Pack and Action View.

ActiveModel::Model now only includes ActiveModel::API.
This will allow ActiveModel::Model to add more functionality while
keeping backwards compatibility.

Related discussions: #41448 and https://mobile.twitter.com/kaspth/status/1361340090237222912

This the same as an earlier stale PR: #42042 that I couldn't update.

Currently `ActiveModel::Model` is defined as the minimum API to talk
with Action Pack and Action View.
Its name suggests it can be included to create Active Record type
models, but for creating models it's probably too minimal. For example
it's very common to include ActiveModel::Attributes as well.

By moving `ActiveModel::Model`'s implementation to a new
`ActiveModel::API` we keep a definition of the minimum API to talk with
Action Pack and Action View.

For `ActiveModel::Model` we only need to include `ActiveModel::API`.
This will allow adding more funcationality to `ActiveModel::Model` while
keeping backwards compatibility.

Co-authored-by: Nathaniel Watts <1141717+thewatts@users.noreply.github.com>
@p8
Copy link
Member Author

p8 commented Sep 15, 2021

@rafaelfranca I had some trouble with updating #42042 so I recreated it here.

@rafaelfranca rafaelfranca merged commit ee2a3f2 into rails:main Sep 15, 2021
@p8 p8 deleted the active-model-api branch September 15, 2021 17:13
@JoshTeperman
Copy link

❤️ exciting stuff, thanks for your work!

@p8
Copy link
Member Author

p8 commented Sep 16, 2021

Thanks @JoshTeperman 😄

@intrip
Copy link
Contributor

intrip commented Sep 17, 2021

Nice one!

@p8
Copy link
Member Author

p8 commented Sep 17, 2021

Thanks @intrip !

tagliala added a commit to DavyJonesLocker/client_side_validations that referenced this pull request Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants