From 57070277b420819b9bf0980e1a794a587f31dff6 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 11 Sep 2005 09:41:24 +0000 Subject: Added better exception error when unknown column types are used with migrations #1814 [fbeausoleil@ftml.net] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2201 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/active_record/connection_adapters/abstract_adapter.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/connection_adapters/abstract_adapter.rb') diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index f5aa09c1f2..5f9f99b0b2 100755 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -431,7 +431,14 @@ module ActiveRecord end def type_to_sql(type, limit = nil) - native = native_database_types[type] + unless native = native_database_types[type] + raise( + ActiveRecord::UnknownTypeError, + "Unable to convert type '#{type}' to a native type. " + + "Valid options: #{native_database_types.keys.to_sentence}" + ) + end + limit ||= native[:limit] column_type_sql = native[:name] column_type_sql << "(#{limit})" if limit -- cgit v1.2.3