Skip to content

Instantly share code, notes, and snippets.

@bakineggs
Created October 2, 2012 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bakineggs/3823667 to your computer and use it in GitHub Desktop.
Save bakineggs/3823667 to your computer and use it in GitHub Desktop.
HashWithIndifferentAccess equality
$ bundle exec script/console
Loading development environment (Rails 2.3.14)
>> {:a => :b} == {:a => :b}.with_indifferent_access
=> false
>> {:a => :b} == {'a' => :b}.with_indifferent_access
=> false
>> {'a' => :b} == {:a => :b}.with_indifferent_access
=> true
>> {'a' => :b} == {'a' => :b}.with_indifferent_access
=> true
>> {:a => :b}.with_indifferent_access == {:a => :b}
=> false
>> {:a => :b}.with_indifferent_access == {'a' => :b}
=> true
>> {'a' => :b}.with_indifferent_access == {:a => :b}
=> false
>> {'a' => :b}.with_indifferent_access == {'a' => :b}
=> true
@agibralter
Copy link

this is weird... no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment