aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-02-28 11:53:48 +0100
committerJosé Valim <jose.valim@gmail.com>2010-02-28 11:53:48 +0100
commitf3839b2b9996f84be6599e940a38e43237f35367 (patch)
treecc94ac9da0ab091d9a48b8c0b2a248b1c07e34af /activerecord
parentae8070e21be405331a1ad97f59c4e43d45f10eb3 (diff)
downloadrails-f3839b2b9996f84be6599e940a38e43237f35367.tar.gz
rails-f3839b2b9996f84be6599e940a38e43237f35367.tar.bz2
rails-f3839b2b9996f84be6599e940a38e43237f35367.zip
ActiveRecord should raise an error on invalid migration types.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb11
-rw-r--r--activerecord/test/cases/ar_schema_test.rb10
2 files changed, 17 insertions, 4 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 520f3c8c0c..64faaef4a0 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
@@ -319,16 +319,19 @@ module ActiveRecord
def method_missing(symbol, *args)
if symbol.to_s == 'xml'
xml_column_fallback(args)
+ else
+ super
end
end
def xml_column_fallback(*args)
case @base.adapter_name.downcase
- when 'sqlite', 'mysql'
- options = args.extract_options!
- column(args[0], :text, options)
- end
+ when 'sqlite', 'mysql'
+ options = args.extract_options!
+ column(args[0], :text, options)
end
+ end
+
# Appends a primary key definition to the table definition.
# Can be called multiple times, but this is probably not a good idea.
def primary_key(name)
diff --git a/activerecord/test/cases/ar_schema_test.rb b/activerecord/test/cases/ar_schema_test.rb
index 4c1589d965..665c387d5d 100644
--- a/activerecord/test/cases/ar_schema_test.rb
+++ b/activerecord/test/cases/ar_schema_test.rb
@@ -27,6 +27,16 @@ if ActiveRecord::Base.connection.supports_migrations?
assert_nothing_raised { @connection.select_all "SELECT * FROM schema_migrations" }
assert_equal 7, ActiveRecord::Migrator::current_version
end
+
+ def test_schema_raises_an_error_for_invalid_column_ntype
+ assert_raise NoMethodError do
+ ActiveRecord::Schema.define(:version => 8) do
+ create_table :vegetables do |t|
+ t.unknown :color
+ end
+ end
+ end
+ end
end
end