From 999dcca3eda8c92ec1db285171897cb70f946610 Mon Sep 17 00:00:00 2001 From: Ryosuke Hiroe Date: Wed, 12 Jun 2024 10:02:10 +0900 Subject: [PATCH] remove: ActiveModel::Serialization#send and ActiveModel::Validations#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. https://github.com/ruby/gem_rbs_collection/commit/2e17636b572835f4b114dbb7c8942f007e71d69a It appears to have been added by this commit, but appears to work fine without it. --- gems/activemodel/6.0/_test/test.rb | 3 +++ gems/activemodel/6.0/patch.rbs | 14 -------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/gems/activemodel/6.0/_test/test.rb b/gems/activemodel/6.0/_test/test.rb index 88fe5f6e..09432872 100644 --- a/gems/activemodel/6.0/_test/test.rb +++ b/gems/activemodel/6.0/_test/test.rb @@ -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?) diff --git a/gems/activemodel/6.0/patch.rbs b/gems/activemodel/6.0/patch.rbs index ef493bb4..e29cdabf 100644 --- a/gems/activemodel/6.0/patch.rbs +++ b/gems/activemodel/6.0/patch.rbs @@ -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