Skip to content

Instantly share code, notes, and snippets.

@arjones
Created February 22, 2010 19:35
Show Gist options
  • Save arjones/311395 to your computer and use it in GitHub Desktop.
Save arjones/311395 to your computer and use it in GitHub Desktop.
# RAILS_ROOT/config/initializers/ordered_hash_hacks.rb
class OrderedHash
def method_missing(method_name, *args, &block)
method_name = :_id if method_name == :id
if self.keys.include?(method_name.to_s)
self.send('[]', method_name.to_s)
else
super
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment