Created
July 27, 2015 19:43
-
-
Save selvait90/58cdf5c46fe89feeeea7 to your computer and use it in GitHub Desktop.
Ordered Hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> oh=ActiveSupport::OrderedHash.new | |
=> #<OrderedHash {}> | |
>> oh | |
=> #<OrderedHash {}> | |
>> oh['secondary_entity_id']= "169435" => "169435" | |
>> oh["place_entity_attributes"] = {"id"=>"123456"} | |
=> {"id"=>"123456"} | |
>> oh | |
=> #<OrderedHash {"place_entity_attributes"=>{"id"=>"123456"}, "secondary_entity_id"=>"169435"}> | |
>> oh.sort.reverse | |
=> [["secondary_entity_id", "169435"], ["place_entity_attributes", {"id"=>"123456"}]] | |
?> Hash[oh.sort.reverse] | |
=> {"place_entity_attributes"=>{"id"=>"123456"}, "secondary_entity_id"=>"169435"} | |
>> OrderedHash[oh.sort.reverse] | |
NameError: uninitialized constant OrderedHash | |
from /home/selva/.rbenv/versions/ree-1.8.7-2012.02/lib/ruby/gems/1.8/bundler/gems/rails-63daeef511db/activesupport/lib/active_support/dependencies.rb:469:in `load_missing_co | |
nstant' | |
from /home/selva/.rbenv/versions/ree-1.8.7-2012.02/lib/ruby/gems/1.8/bundler/gems/rails-63daeef511db/activesupport/lib/active_support/dependencies.rb:106:in `const_missing' | |
from /home/selva/.rbenv/versions/ree-1.8.7-2012.02/lib/ruby/gems/1.8/bundler/gems/rails-63daeef511db/activesupport/lib/active_support/dependencies.rb:118:in `const_missing' | |
from (irb):120 | |
from :0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment