aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/core.rb
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2017-01-05 17:20:57 +0900
committerAkira Matsuda <ronnie@dio.jp>2017-01-05 19:58:52 +0900
commit5473e390d362755125d2f47b64ef0a135f2fe111 (patch)
treeb9c199a3c78ad307ed034cf5618e2897dfa650c6 /activerecord/lib/active_record/core.rb
parent6197a38bca988f05087aa022e288922cf0331d6c (diff)
downloadrails-5473e390d362755125d2f47b64ef0a135f2fe111.tar.gz
rails-5473e390d362755125d2f47b64ef0a135f2fe111.tar.bz2
rails-5473e390d362755125d2f47b64ef0a135f2fe111.zip
`self.` is not needed when calling its own instance method
Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
Diffstat (limited to 'activerecord/lib/active_record/core.rb')
-rw-r--r--activerecord/lib/active_record/core.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb
index 6d2361c4ac..4d30bdf196 100644
--- a/activerecord/lib/active_record/core.rb
+++ b/activerecord/lib/active_record/core.rb
@@ -450,7 +450,7 @@ module ActiveRecord
# [ Person.find(1), Person.find(2), Person.find(3) ] & [ Person.find(1), Person.find(4) ] # => [ Person.find(1) ]
def hash
if id
- self.class.hash ^ self.id.hash
+ self.class.hash ^ id.hash
else
super
end
@@ -472,7 +472,7 @@ module ActiveRecord
# Allows sort on objects
def <=>(other_object)
if other_object.is_a?(self.class)
- self.to_key <=> other_object.to_key
+ to_key <=> other_object.to_key
else
super
end