aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xactiverecord/lib/active_record/base.rb3
-rwxr-xr-xactiverecord/lib/active_record/connection_adapters/abstract_adapter.rb10
-rw-r--r--activerecord/test/active_schema_test.rb14
3 files changed, 1 insertions, 26 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 2d7cd6c17a..c761153941 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -28,8 +28,6 @@ module ActiveRecord #:nodoc:
end
class ConfigurationError < StandardError #:nodoc:
end
- class UnknownTypeError < ActiveRecordError #:nodoc:
- end
class AttributeAssignmentError < ActiveRecordError #:nodoc:
attr_reader :exception, :attribute
@@ -224,7 +222,6 @@ module ActiveRecord #:nodoc:
# objects that should be inspected to determine which attributes triggered the errors.
# * +AttributeAssignmentError+ -- an error occurred while doing a mass assignment through the +attributes=+ method.
# You can inspect the +attribute+ property of the exception object to determine which attribute triggered the error.
- # * +UnknownTypeError+ -- Raised when AbstractAdapter#type_to_sql cannot map the type given to a native type.
#
# *Note*: The attributes listed are class-level attributes (accessible from both the class and instance level).
# So it's possible to assign a logger to the class through Base.logger= which will then be used by all
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index 5f9f99b0b2..e0c880780e 100755
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -392,7 +392,6 @@ module ActiveRecord
end
def add_column(table_name, column_name, type, options = {})
- native_type = native_database_types[type]
add_column_sql = "ALTER TABLE #{table_name} ADD #{column_name} #{type_to_sql(type, options[:limit])}"
add_column_options!(add_column_sql, options)
execute(add_column_sql)
@@ -431,14 +430,7 @@ module ActiveRecord
end
def type_to_sql(type, limit = nil)
- 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
-
+ native = native_database_types[type]
limit ||= native[:limit]
column_type_sql = native[:name]
column_type_sql << "(#{limit})" if limit
diff --git a/activerecord/test/active_schema_test.rb b/activerecord/test/active_schema_test.rb
deleted file mode 100644
index d2617167a0..0000000000
--- a/activerecord/test/active_schema_test.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-require 'abstract_unit'
-
-class ActiveSchemaTest < Test::Unit::TestCase
- def test_add_column_with_native_type_rejected
- assert_raises ActiveRecord::UnknownTypeError do
- add_column(:people, :varchar, :limit => 15)
- end
- end
-
- private
- def method_missing(method_symbol, *arguments)
- ActiveRecord::Base.connection.send(method_symbol, *arguments)
- end
-end \ No newline at end of file