=== has absolutely nothing whatsoever to do with equality. In particular, it violates pretty much every law that you would ecpect an equality operator to follow. And it does that very much by design. – Jörg W Mittag Dec 17 '10 at 5:08 [1]
#User.first.class.method(:===).source_location# "/Users/qinmingyuan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activerecord-5.2.0/lib/active_record/core.rb" 250L# Overwrite the default class equality method to provide support for decorated models.def===(object)object.is_a?(self)end