ruby - Error adding decimal column: precision cannot be empty

查看:185
本文介绍了ruby - Error adding decimal column: precision cannot be empty的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

数据库迁移文件如下

class CreateWorks < ActiveRecord::Migration
  def change
    create_table :works do |t|
      t.integer :project_id
      t.integer :user_id
      t.datetime :datetimeperformed
      t.decimal :hours, percision: 5, scale: 2
      t.timestamps null: false
    end
  end
end

执行:

rake db:migrate 

报错
Error adding decimal column: precision cannot be empty if scale is specified

不知道是什么原因,请帮忙看一下,谢谢!

解决方案

已解决,precision拼写错误!

这篇关于ruby - Error adding decimal column: precision cannot be empty的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆