CreateTable supports all PG-specific columns even under Rails 4.0

Successive versions of Rails provided explicit support for more column
types such as `money` and `uuid`. However, the ability to create a
Postgres table with one of these column type is really dependent on
which Postgres version you're using, and not which Rails version you're
using -- all you have to do is use `t.column` rather than e.g.,
`t.money`, `t.uuid`, etc.
This commit is contained in:
Elliot Winkler 2016-01-09 23:13:55 -07:00
parent a559713f96
commit d9a887b905
2 changed files with 1 additions and 10 deletions

View File

@ -47,14 +47,7 @@ module UnitTests
column_options = {}
end
begin
table.__send__(column_type, column_name, column_options)
rescue NoMethodError
raise ColumnNotSupportedError.new(
"#{Tests::Database.instance.adapter_class} does not support " +
":#{column_type} columns."
)
end
table.column(column_name, column_type, column_options)
end
end
end

View File

@ -72,8 +72,6 @@ module UnitTests
def whitelist_attributes?
options.fetch(:whitelist_attributes, true)
end
ColumnNotSupportedError = Class.new(StandardError)
end
end
end