【发布时间】:2013-09-03 08:56:59
【问题描述】:
我有以下迁移:
class CreateTariffs < ActiveRecord::Migration
def change
create_table :tariffs do |t|
t.string :name
t.decimal :amount, precision: 10, scale: 6, default: 0.0
t.timestamps
end
end
end
我的迁移失败,出现以下异常:
undefined method `sql_type' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::ColumnDefinition:0x000000089a4108>/home/polygalin/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-postgres-array-0.0.9/lib/activerecord-postgres-array/activerecord.rb:42:in `quote_with_array'
但如果我删除“金额”列的默认值,迁移成功。 任何人都可以帮助找出为什么迁移失败并使用小数列的默认值?
【问题讨论】:
-
你试过浮动吗?
-
Rails 适配器似乎有问题,请查看stackoverflow.com/questions/8287233/…
标签: ruby-on-rails ruby-on-rails-4 rails-migrations rails-postgresql