-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
activemodel: ActiveModel::Errors#add accepts String and Proc for type (…
…#717) * refactor(activemodel): move ActiveModel::Errors#add from generated * fix(activemodel): ActiveModel::Errors#add accepts String and Proc for type The behavior of passing String or Proc for type should be allowed. FYI: It is documented in 6.1, but It is already available in 6.0. cf. rails/rails@fcd1e41#diff-4deafad6fefcf6aa6626a1f7e3cd0ca1cf95e358f55a10a69e02be84d926bb31R368-R374 cf. rails/rails@d9011e3#diff-4deafad6fefcf6aa6626a1f7e3cd0ca1cf95e358f55a10a69e02be84d926bb31R370 Also, the name of the second argument was changed from `message` to `type` in 6.1. * fix(activemodel): Divide type definition of ActiveModel::Errors#add to 6.0 and 7.0 ActiveModel::Error was added on 6.1. cf. rails/rails@ef68d3e On 6.1 or later, ActiveModel::Errors#add returns ActiveModel::Error. On the other hand, `ActiveModel::Errors#add` returns messages array on rails 6.0, because last evaluated is `Array#<<`. cf. https://github.com/rails/rails/blob/v6.0.0/activemodel/lib/active_model/errors.rb#L311-L322 Currently in gem_rbs_collection, activemodel type definitions are defined 6.0 and 7.0, but not 6.1. cf. #615 So I divide type definition of ActiveModel::Errors#add to 6.0 and 7.0.
- Loading branch information
1 parent
ccbd2bb
commit 09beb21
Showing
8 changed files
with
124 additions
and
47 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
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
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 |
---|---|---|
@@ -1,6 +1,10 @@ | ||
class Person | ||
include ActiveModel::Model | ||
include ActiveModel::Validations | ||
extend ActiveModel::Validations::ClassMethods | ||
|
||
attr_accessor name: String? | ||
attr_accessor email: String? | ||
|
||
def should_be_satisfied_special_email_rule: () -> void | ||
end |
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