diff options
author | Willian Gustavo Veiga <beberveiga@gmail.com> | 2018-10-22 20:06:45 -0300 |
---|---|---|
committer | Willian Gustavo Veiga <beberveiga@gmail.com> | 2018-10-22 20:06:45 -0300 |
commit | 47ef6fd2ca596a7d47bac6b584d5eced46e0d4d8 (patch) | |
tree | 26d0a84a3cefd153b5315c37addb784e1b9228f3 /activerecord/lib/active_record/attribute_methods/read.rb | |
parent | c8ff9bd63a2371b6f0f0b4f48abf29cf89a1d397 (diff) | |
parent | e853acb9b4cfb5bb91a241cf37084631cd145823 (diff) | |
download | rails-47ef6fd2ca596a7d47bac6b584d5eced46e0d4d8.tar.gz rails-47ef6fd2ca596a7d47bac6b584d5eced46e0d4d8.tar.bz2 rails-47ef6fd2ca596a7d47bac6b584d5eced46e0d4d8.zip |
Merge branch 'master' into feature/reselect-method
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods/read.rb')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/read.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/read.rb b/activerecord/lib/active_record/attribute_methods/read.rb index ff0e863529..6e1275e990 100644 --- a/activerecord/lib/active_record/attribute_methods/read.rb +++ b/activerecord/lib/active_record/attribute_methods/read.rb @@ -29,10 +29,9 @@ module ActiveRecord # it has been typecast (for example, "2004-12-12" in a date column is cast # to a date object, like Date.new(2004, 12, 12)). def read_attribute(attr_name, &block) - name = if self.class.attribute_alias?(attr_name) - self.class.attribute_alias(attr_name).to_s - else - attr_name.to_s + name = attr_name.to_s + if self.class.attribute_alias?(name) + name = self.class.attribute_alias(name) end primary_key = self.class.primary_key |