--You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.To post to this group, send email to rubyonra...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0aaf2c2143754731d6dd53614fa5dc84%40ruby-forum.com.For more options, visit https://groups.google.com/groups/opt_out.
> I do know that Hash don't allow duplicate keys. But I would like to by
> which method hash check if any duplicate key present into it or not? As
> I can see "foo" have different `object_id`,which is expected. But in
> case of Hash key how this two different objects "foo" is treated as same
> object?
The hash's keys' object id's are not what is compared. If you take both of those strings, and did this:
"foo" == "foo"
You'd get true, regardless of the fact they have different object ids.
You are making this way way way more complicated than it is.