aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods.rb
diff options
context:
space:
mode:
authorDylan Thacker-Smith <Dylan.Smith@shopify.com>2018-06-22 11:54:31 -0400
committerJeremy Daer <jeremydaer@gmail.com>2018-10-12 09:50:10 -0700
commit99c87ad2474d5c5b6e52ceac34c3cf9f9cb57f9f (patch)
treef1000530afb4b52af586e5486db5df50b52b9e81 /activerecord/lib/active_record/attribute_methods.rb
parentee95bed3e6e16eadd1940d9c27953236f1649c08 (diff)
downloadrails-99c87ad2474d5c5b6e52ceac34c3cf9f9cb57f9f.tar.gz
rails-99c87ad2474d5c5b6e52ceac34c3cf9f9cb57f9f.tar.bz2
rails-99c87ad2474d5c5b6e52ceac34c3cf9f9cb57f9f.zip
Improve model attribute accessor method names for backtraces
Ruby uses the original method name, so will show the __temp__ method name in the backtrace. However, in the common case the method name is compatible with the `def` keyword, so we can avoid the __temp__ method name in that case to improve the name shown in backtraces or TracePoint#method_id.
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods.rb')
-rw-r--r--activerecord/lib/active_record/attribute_methods.rb9
1 files changed, 0 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb
index 221ebea8ea..3c785180e1 100644
--- a/activerecord/lib/active_record/attribute_methods.rb
+++ b/activerecord/lib/active_record/attribute_methods.rb
@@ -22,15 +22,6 @@ module ActiveRecord
delegate :column_for_attribute, to: :class
end
- AttrNames = Module.new {
- def self.set_name_cache(name, value)
- const_name = "ATTR_#{name}"
- unless const_defined? const_name
- const_set const_name, -value
- end
- end
- }
-
RESTRICTED_CLASS_METHODS = %w(private public protected allocate new name parent superclass)
class GeneratedAttributeMethods < Module #:nodoc: