-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
activerecord: CollectionProxy#build can take Hash-like object
The current definition of `#build`, `#craete` and `#create!` methods of `ActiveRecord::Associations::CollectionProxy#build` take a Hash object. But they can also take Hash-like object. Usually, Rails apps pass an instance of `ActionController::Parameters`. The technique is well known as "Mass Assignment". Internally, they expects the object should have `#each_pair` method. Therefore, this changes the signature of these methods to take a Hash-like object instead of Hash. refs: https://github.com/rails/rails/blob/v7.0.0/activemodel/lib/active_model/attribute_assignment.rb#L29
- Loading branch information
Showing
5 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
additional_gems: | ||
- actionpack |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
- file: activerecord-generated.rb | ||
diagnostics: | ||
- range: | ||
start: | ||
line: 1 | ||
character: 6 | ||
end: | ||
line: 1 | ||
character: 10 | ||
severity: ERROR | ||
message: Cannot find implementation of method `::User#articles` | ||
code: Ruby::MethodDefinitionMissing |
This file contains 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