Issue #7377 has been updated by trans (Thomas Sawyer).


"and calling `SomeActiveRecordModel.first` twice will not give you the same object even if they share the same `id`"

That's not the id we mean. In Ruby every object has a unique id.

  x = "foo"
  x.object_id  #=> 17086140

So to ask `x.identical? y` is the to ask `x.object_id == y.object_id`. And that's how it works under the hood. Which is why I think a term the indicates the "id" aspect of this is nicer and really fortunate that we even have available to us. I'm not saying #same_object? is an awful choice. It would still be better than the current confusion. But #identical? gives us a little bit stronger semantics.

----------------------------------------
Feature #7377: #indetical? as an alias for #equal?
https://bugs.ruby-lang.org/issues/7377#change-33393

Author: aef (Alexander E. Fischer)
Status: Open
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: 


As my feature request #7359 got rejected, here a more backward-compatible approach:

In my opinion the difference between #eql? and #equal? is really unintuitive. How about making their difference more obvious by giving one of them a more accurate name? 

My proposal is to alias #equal? to #identical?.

I'll write a patch, if this is acceptable.


-- 
http://bugs.ruby-lang.org/