aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods/read.rb
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2016-02-10 20:29:48 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2016-02-10 20:29:48 -0300
commit2db347bebc9d3f39b3c5e274b7c9beecfce73913 (patch)
tree1fe1659ff0543543be4798dff791993881261117 /activerecord/lib/active_record/attribute_methods/read.rb
parent81f75f578a06bafd7cb23643760788a8ddc8d657 (diff)
parente944e67001a1bebd1f7305f5b30f5ae9361ecb28 (diff)
downloadrails-2db347bebc9d3f39b3c5e274b7c9beecfce73913.tar.gz
rails-2db347bebc9d3f39b3c5e274b7c9beecfce73913.tar.bz2
rails-2db347bebc9d3f39b3c5e274b7c9beecfce73913.zip
Merge pull request #23395 from PareshGupta/remove-unused-constant
Remove unused ReaderMethodCache and WriterMethodCache constants from ActiveRecord
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods/read.rb')
-rw-r--r--activerecord/lib/active_record/attribute_methods/read.rb22
1 files changed, 5 insertions, 17 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/read.rb b/activerecord/lib/active_record/attribute_methods/read.rb
index 5197e21fa4..ab2ecaa7c5 100644
--- a/activerecord/lib/active_record/attribute_methods/read.rb
+++ b/activerecord/lib/active_record/attribute_methods/read.rb
@@ -1,8 +1,11 @@
module ActiveRecord
module AttributeMethods
module Read
- ReaderMethodCache = Class.new(AttributeMethodCache) {
- private
+ extend ActiveSupport::Concern
+
+ module ClassMethods
+ protected
+
# We want to generate the methods via module_eval rather than
# define_method, because define_method is slower on dispatch.
# Evaluating many similar methods may use more memory as the instruction
@@ -21,21 +24,6 @@ module ActiveRecord
# to allocate an object on each call to the attribute method.
# Making it frozen means that it doesn't get duped when used to
# key the @attributes in read_attribute.
- def method_body(method_name, const_name)
- <<-EOMETHOD
- def #{method_name}
- name = ::ActiveRecord::AttributeMethods::AttrNames::ATTR_#{const_name}
- _read_attribute(name) { |n| missing_attribute(n, caller) }
- end
- EOMETHOD
- end
- }.new
-
- extend ActiveSupport::Concern
-
- module ClassMethods
- protected
-
def define_method_attribute(name)
safe_name = name.unpack('h*'.freeze).first
temp_method = "__temp__#{safe_name}"