Skip to content

Commit

Permalink
remove: ActiveModel::Serialization#send and ActiveModel::Validations#…
Browse files Browse the repository at this point in the history
…send (#595)

Passing a Symbol argument to these methods will result in an error.

```
Cannot pass a value of type `::Symbol` as an argument of type `::String`
  ::Symbol <: ::String
    ::Object <: ::String
      ::BasicObject <: ::String(Ruby::ArgumentTypeMismatch)
```

Also, these methods do not exist.

2e17636
It appears to have been added by this commit, but appears to work fine without it.
  • Loading branch information
rhiroe authored Jun 12, 2024
1 parent c3dd30b commit 999dcca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
3 changes: 3 additions & 0 deletions gems/activemodel/6.0/_test/test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
class Person
include ActiveModel::Model
include ActiveModel::Validations
attr_accessor :name, :age, :email

validates :name, presence: true, length: { maximum: 100 }
validates :email, presence: true, if: -> { age >= 20 }
end

Person.new.send(:valid?)
14 changes: 0 additions & 14 deletions gems/activemodel/6.0/patch.rbs
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
module ActiveModel
module Serialization
# It is necessary to satisfy alias target.
# TODO: Define this method to correct place.
def `send`: (String name, *untyped args) ?{ (*untyped) -> untyped } -> untyped
end

module Validations
# It is necessary to satisfy alias target.
# TODO: Define this method to correct place.
def `send`: (String name, *untyped args) ?{ (*untyped) -> untyped } -> untyped
end
end

# Remove the fake types for Gem::Version
# if the real types are available.
module Gem
Expand Down

0 comments on commit 999dcca

Please sign in to comment.