aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract_adapter.rb')
-rwxr-xr-xactiverecord/lib/active_record/connection_adapters/abstract_adapter.rb9
1 files changed, 8 insertions, 1 deletions
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