aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-10-15 17:40:17 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2014-10-15 17:40:17 -0700
commit99798b99c05762886217cbd9fc6d2517127caf53 (patch)
tree3626ceb9f6b3025fde86e2824e531d0db45422d5 /activerecord
parent66cd96d0e99051dfed08dbedd561f298f9e37c18 (diff)
downloadrails-99798b99c05762886217cbd9fc6d2517127caf53.tar.gz
rails-99798b99c05762886217cbd9fc6d2517127caf53.tar.bz2
rails-99798b99c05762886217cbd9fc6d2517127caf53.zip
we don't need a HWIA and a hash allocated for just one k/v pair
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb8
1 files changed, 3 insertions, 5 deletions
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