-1
對不起,我的英文。 我搜索了該網站,但我找不到解決方案。 當我試圖讓軌道分貝:遷移給了我這個錯誤:Rails db:migrate用「未定義的局部變量或方法」限制「中止」爲什麼?
C:\PW\Sites\grota>rails db:migrate
== 20170209014957 CreateWholesalers: migrating ================================
-- create_table(:wholesalers)
-- limit()
rails aborted!
StandardError: An error has occurred, all later migrations canceled:
undefined local variable or method `limit' for # <CreateWholesalers:0x00000006bfc6a0>
C:/PW/Sites/grota/db/migrate/20170209014957_create_wholesalers.rb:7:in `block in change'
C:/PW/Sites/grota/db/migrate/20170209014957_create_wholesalers.rb:3:in `change'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
NameError: undefined local variable or method `limit' for # <CreateWholesalers:0x00000006bfc6a0>
C:/PW/Sites/grota/db/migrate/20170209014957_create_wholesalers.rb:7:in `block in change'
C:/PW/Sites/grota/db/migrate/20170209014957_create_wholesalers.rb:3:in `change'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
這裏是我的代碼遷移:
class CreateWholesalers < ActiveRecord::Migration[5.0]
def change
create_table :wholesalers do |t|
t.string "brand_name", :limit => 25
t.string "username", :limit => 25
t.string "password_digest"
t.string "email", limit => 50
t.decimal "latitude"
t.decimal "longitude"
t.timestamps
end
end
end
預先感謝您。
謝謝,它的工作! –