From 99798b99c05762886217cbd9fc6d2517127caf53 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 15 Oct 2014 17:40:17 -0700 Subject: we don't need a HWIA and a hash allocated for just one k/v pair --- .../connection_adapters/abstract/schema_definitions.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index 03ab48784a..adb9fcaeb8 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -318,7 +318,7 @@ module ActiveRecord alias :belongs_to :references def new_column_definition(name, type, options) # :nodoc: - type = aliased_types[type] || type + type = aliased_types(type.to_s, type) column = create_column_definition name, type limit = options.fetch(:limit) do native[type][:limit] if native[type].is_a?(Hash) @@ -344,10 +344,8 @@ module ActiveRecord @native end - def aliased_types - HashWithIndifferentAccess.new( - timestamp: :datetime, - ) + def aliased_types(name, fallback) + 'timestamp' == name ? :datetime : fallback end end -- cgit v1.2.3