diff options
author | Willian Gustavo Veiga <beberveiga@gmail.com> | 2018-10-17 20:24:44 -0300 |
---|---|---|
committer | Willian Gustavo Veiga <beberveiga@gmail.com> | 2018-10-17 20:24:44 -0300 |
commit | c8ff9bd63a2371b6f0f0b4f48abf29cf89a1d397 (patch) | |
tree | e72e4476555fbee75961e473ce336c08fdd10fa6 /activerecord/lib/active_record/attribute_methods.rb | |
parent | 99bd626885b72acd44861727918ee107a649e2b4 (diff) | |
parent | ead868315f9b0fedb351c9b451aa1f66a2dc8038 (diff) | |
download | rails-c8ff9bd63a2371b6f0f0b4f48abf29cf89a1d397.tar.gz rails-c8ff9bd63a2371b6f0f0b4f48abf29cf89a1d397.tar.bz2 rails-c8ff9bd63a2371b6f0f0b4f48abf29cf89a1d397.zip |
Merge branch 'master' into feature/reselect-method
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods.rb')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods.rb | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index 221ebea8ea..eeb88e4b7a 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: @@ -270,21 +261,14 @@ module ActiveRecord def respond_to?(name, include_private = false) return false unless super - case name - when :to_partial_path - name = "to_partial_path" - when :to_model - name = "to_model" - else - name = name.to_s - end - # If the result is true then check for the select case. # For queries selecting a subset of columns, return false for unselected columns. # We check defined?(@attributes) not to issue warnings if called on objects that # have been allocated but not yet initialized. - if defined?(@attributes) && self.class.column_names.include?(name) - return has_attribute?(name) + if defined?(@attributes) + if name = self.class.symbol_column_to_string(name.to_sym) + return has_attribute?(name) + end end true |