diff --git a/activerecord/lib/active_record/store.rb b/activerecord/lib/active_record/store.rb index 5cce0c6672..59b8a90b59 100644 --- a/activerecord/lib/active_record/store.rb +++ b/activerecord/lib/active_record/store.rb @@ -251,7 +251,7 @@ module ActiveRecord attribute = object.send(store_attribute) unless attribute.is_a?(ActiveSupport::HashWithIndifferentAccess) attribute = IndifferentCoder.as_indifferent_hash(attribute) - object.send :"#{store_attribute}=", attribute + object.public_send :"#{store_attribute}=", attribute end attribute end diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index b81ee4e713..d66e37a903 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -566,9 +566,9 @@ class AttributeMethodsTest < ActiveRecord::TestCase meth = "#{prefix}title" assert_respond_to topic, meth - assert_equal ["title"], topic.send(meth) - assert_equal ["title", "a"], topic.send(meth, "a") - assert_equal ["title", 1, 2, 3], topic.send(meth, 1, 2, 3) + assert_equal ["title"], topic.public_send(meth) + assert_equal ["title", "a"], topic.public_send(meth, "a") + assert_equal ["title", 1, 2, 3], topic.public_send(meth, 1, 2, 3) end end @@ -580,9 +580,9 @@ class AttributeMethodsTest < ActiveRecord::TestCase meth = "title#{suffix}" assert_respond_to topic, meth - assert_equal ["title"], topic.send(meth) - assert_equal ["title", "a"], topic.send(meth, "a") - assert_equal ["title", 1, 2, 3], topic.send(meth, 1, 2, 3) + assert_equal ["title"], topic.public_send(meth) + assert_equal ["title", "a"], topic.public_send(meth, "a") + assert_equal ["title", 1, 2, 3], topic.public_send(meth, 1, 2, 3) end end @@ -594,9 +594,9 @@ class AttributeMethodsTest < ActiveRecord::TestCase meth = "#{prefix}title#{suffix}" assert_respond_to topic, meth - assert_equal ["title"], topic.send(meth) - assert_equal ["title", "a"], topic.send(meth, "a") - assert_equal ["title", 1, 2, 3], topic.send(meth, 1, 2, 3) + assert_equal ["title"], topic.public_send(meth) + assert_equal ["title", "a"], topic.public_send(meth, "a") + assert_equal ["title", 1, 2, 3], topic.public_send(meth, 1, 2, 3) end end diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 250fac64f7..30261f37d0 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -706,12 +706,12 @@ class BasicsTest < ActiveRecord::TestCase def test_non_valid_identifier_column_name weird = Weird.create("a$b" => "value") weird.reload - assert_equal "value", weird.send("a$b") + assert_equal "value", weird.public_send("a$b") assert_equal "value", weird.read_attribute("a$b") weird.update_columns("a$b" => "value2") weird.reload - assert_equal "value2", weird.send("a$b") + assert_equal "value2", weird.public_send("a$b") assert_equal "value2", weird.read_attribute("a$b") end diff --git a/activerecord/test/cases/scoping/named_scoping_test.rb b/activerecord/test/cases/scoping/named_scoping_test.rb index a1c9443aaf..da00d44b92 100644 --- a/activerecord/test/cases/scoping/named_scoping_test.rb +++ b/activerecord/test/cases/scoping/named_scoping_test.rb @@ -410,8 +410,8 @@ class NamedScopingTest < ActiveRecord::TestCase scope :"title containing space", ->(space: " ") { where("title LIKE '%#{space}%'") } scope :approved, -> { where(approved: true) } end - assert_equal klass.where("title LIKE '% %'"), klass.send(:"title containing space", space: " ") - assert_equal klass.approved.where("title LIKE '% %'"), klass.approved.send(:"title containing space", space: " ") + assert_equal klass.where("title LIKE '% %'"), klass.public_send(:"title containing space", space: " ") + assert_equal klass.approved.where("title LIKE '% %'"), klass.approved.public_send(:"title containing space", space: " ") end def test_find_all_should_behave_like_select