Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

`connection.type_to_sql` returns a `String` for unmapped types.

Closes #13146.

This fixes an error when using:

```
change_colum :table, :column, :bigint, array: true
```

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/test/cases/adapter_test.rb
  • Loading branch information...
commit 9b0ad8d7998e43ac0721f12f227b30be120f19dc 1 parent 6e0ae5b
@senny senny authored
View
11 activerecord/CHANGELOG.md
@@ -1,3 +1,14 @@
+* `type_to_sql` returns a `String` for unmapped columns. This fixes an error
+ when using unmapped array types in combination with PostgreSQL's `array: true`.
+
+ Fixes #13146.
+
+ Example:
+
+ change_colum :table, :column, :bigint, array: true
+
+ *Jens Fahnenbruck*, *Yves Senn*
+
* Previously, the `has_one` macro incorrectly accepts the `counter_cache`
option due to a bug, although that options was never supported nor
functional on `has_one` and `has_one ... through` relationships. It now
View
2  activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -690,7 +690,7 @@ def type_to_sql(type, limit = nil, precision = nil, scale = nil) #:nodoc:
column_type_sql
else
- type
+ type.to_s
end
end
View
4 activerecord/test/cases/adapter_test.rb
@@ -173,6 +173,10 @@ def test_disable_referential_integrity
end
end
end
+
+ test "type_to_sql returns a String for unmapped types" do
+ assert_equal "special_db_type", @connection.type_to_sql(:special_db_type)
+ end
end
class AdapterTestWithoutTransaction < ActiveRecord::TestCase
Please sign in to comment.
Something went wrong with that request. Please try again.