diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-05-20 13:55:03 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-05-20 13:55:03 -0700 |
commit | 9f61f31c2cbf8c1d7b6ce33f28c67f900774fd58 (patch) | |
tree | 84c352e176db99f6d195be7277f10c974240dd39 /activerecord/lib/active_record/connection_adapters/type | |
parent | 25c672637206a2c48fd829c58596c788b6e31c5d (diff) | |
download | rails-9f61f31c2cbf8c1d7b6ce33f28c67f900774fd58.tar.gz rails-9f61f31c2cbf8c1d7b6ce33f28c67f900774fd58.tar.bz2 rails-9f61f31c2cbf8c1d7b6ce33f28c67f900774fd58.zip |
Use the generic type map for PostgreSQL OID registrations
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/type')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/type/hash_lookup_type_map.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/type/hash_lookup_type_map.rb b/activerecord/lib/active_record/connection_adapters/type/hash_lookup_type_map.rb index 828ada00a7..8503d3ea1b 100644 --- a/activerecord/lib/active_record/connection_adapters/type/hash_lookup_type_map.rb +++ b/activerecord/lib/active_record/connection_adapters/type/hash_lookup_type_map.rb @@ -2,10 +2,16 @@ module ActiveRecord module ConnectionAdapters module Type class HashLookupTypeMap < TypeMap # :nodoc: + delegate :key?, to: :@mapping + def lookup(type) @mapping.fetch(type, proc { default_value }).call(type) end + def fetch(type, &block) + @mapping.fetch(type, block).call(type) + end + def alias_type(type, alias_type) register_type(type) { lookup(alias_type) } end |