您好我有一个创建表的迁移(并向现有表添加一列)。
class CreateAdminModule < ActiveRecord::Migration
def change
create_table :admin_module do |t|
t.decimal :no_of_devices_multiplier
t.decimal :option_1_multiplier
t.decimal :option_2_multiplier
t.deciaml :option_3_multiplier
t.decimal :option_4_multiplier
t.decimal :option_5_multiplier
t.timestamps
end
end
add_column :admin_user_roles, :module_admin, :boolean
end
我正在使用mysql2 gem。当我运行迁移时,我得到了这个:
c:\Sites\site>rake db:migrate
-- add_column(:admin_user_roles, :module_admin, :boolean)
-> 0.4726s
== CreateAdminCirrus: migrating ==============================================
-- create_table(:admin_module)
rake aborted!
An error has occurred, all later migrations canceled:
undefined method 'deciaml' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x3c00a80>c:/Sites/site/db/migrate/
20130911082405_create_admin_module.rb:7:in 'block in change'
c:/Sites/site/db/migrate/20130911082405_create_admin_module.rb:3:in 'change'
C:in 'migrate'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
我很困惑,为什么我收到这个错误。我很确定decimal是一个有效的数据类型?我正在使用小数,因为我正在处理货币。
答案 0 :(得分:2)
拼写错误:
t.deciaml :option_3_multiplier
将其更改为:
t.decimal :option_3_multiplier