-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Introduce ActiveModel::API #43223
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
Merged
Merged
Introduce ActiveModel::API #43223
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>
@rafaelfranca I had some trouble with updating #42042 so I recreated it here. |
❤️ exciting stuff, thanks for your work! |
Thanks @JoshTeperman 😄 |
Nice one! |
Thanks @intrip ! |
1 task
tagliala
added a commit
to DavyJonesLocker/client_side_validations
that referenced
this pull request
Oct 24, 2023
Close #924 Ref: - rails/rails@c477d95 - rails/rails#43223
rahat862
pushed a commit
to rahat862/client_side_validations
that referenced
this pull request
Oct 1, 2024
Close #924 Ref: - rails/rails@c477d95 - rails/rails#43223
tk0miya
added a commit
to tk0miya/gem_rbs_collection
that referenced
this pull request
Oct 22, 2024
ActiveModel::API has been added since v7.0. refs: rails/rails#43223
github-actions bot
pushed a commit
to ruby/gem_rbs_collection
that referenced
this pull request
Oct 28, 2024
ActiveModel::API has been added since v7.0. refs: rails/rails#43223
rahat862
pushed a commit
to rahat862/client_side_validation
that referenced
this pull request
Nov 9, 2024
Close #924 Ref: - rails/rails@c477d95 - rails/rails#43223
nayanzin33sergey
added a commit
to nayanzin33sergey/client_side_validations-ruby
that referenced
this pull request
Dec 18, 2024
Close #924 Ref: - rails/rails@c477d95 - rails/rails#43223
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Currently
ActiveModel::Model
is defined as the minimum API to talkwith 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 newActiveModel::API
we keep a definition of the minimum API to talk withAction Pack and Action View.
ActiveModel::Model
now only includesActiveModel::API
.This will allow
ActiveModel::Model
to add more functionality whilekeeping 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.