diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-12-21 01:39:18 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-12-21 01:39:18 +0900 |
commit | 8034dde023a64b98c6b3edb80a44e4cc23f8979f (patch) | |
tree | 38ad756d57390a272bceb7068c19ad1e25587689 /activerecord/lib | |
parent | 3da358ea83b86368021d6f289627d0682d24d30b (diff) | |
download | rails-8034dde023a64b98c6b3edb80a44e4cc23f8979f.tar.gz rails-8034dde023a64b98c6b3edb80a44e4cc23f8979f.tar.bz2 rails-8034dde023a64b98c6b3edb80a44e4cc23f8979f.zip |
Module#{define_method,alias_method,undef_method,remove_method} become public since Ruby 2.5
https://bugs.ruby-lang.org/issues/14133
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/enum.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation/delegation.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/scoping/named.rb | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/enum.rb b/activerecord/lib/active_record/enum.rb index d7cb7691e0..e6dba66a08 100644 --- a/activerecord/lib/active_record/enum.rb +++ b/activerecord/lib/active_record/enum.rb @@ -158,7 +158,7 @@ module ActiveRecord # def self.statuses() statuses end detect_enum_conflict!(name, name.pluralize, true) - singleton_class.send(:define_method, name.pluralize) { enum_values } + singleton_class.define_method(name.pluralize) { enum_values } defined_enums[name] = enum_values detect_enum_conflict!(name, name) diff --git a/activerecord/lib/active_record/relation/delegation.rb b/activerecord/lib/active_record/relation/delegation.rb index 383dc1bf4b..6f67dd3784 100644 --- a/activerecord/lib/active_record/relation/delegation.rb +++ b/activerecord/lib/active_record/relation/delegation.rb @@ -54,7 +54,7 @@ module ActiveRecord end RUBY else - generated_relation_methods.send(:define_method, method) do |*args, &block| + generated_relation_methods.define_method(method) do |*args, &block| scoping { klass.public_send(method, *args, &block) } end end diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb index d5cc5db97e..5278eb29a9 100644 --- a/activerecord/lib/active_record/scoping/named.rb +++ b/activerecord/lib/active_record/scoping/named.rb @@ -179,13 +179,13 @@ module ActiveRecord extension = Module.new(&block) if block if body.respond_to?(:to_proc) - singleton_class.send(:define_method, name) do |*args| + singleton_class.define_method(name) do |*args| scope = all._exec_scope(*args, &body) scope = scope.extending(extension) if extension scope end else - singleton_class.send(:define_method, name) do |*args| + singleton_class.define_method(name) do |*args| scope = body.call(*args) || all scope = scope.extending(extension) if extension scope |