我創建一個簡單的用戶表,當我跑耙db:遷移它似乎create_table(:用戶)Howerver我同時得到以下警告。我試着運行rake數據庫:再次遷移,然後我得到了第二個錯誤在這個頁面上。如何檢查表是否已創建,以及如何防止此警告/錯誤?耙db:遷移失敗
ERROR1
WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
at /Users/anderskitson/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/rdoctask.rb
WARNING: Global access to Rake DSL methods is deprecated. Please include
... Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method DemoApp::Application#task called at /Users/anderskitson/.rvm/gems/[email protected]/gems/railties-3.0.1/lib/rails/application.rb:214:in `initialize_tasks'
ERROR 2
rake aborted!
undefined local variable or method `d' for main:Object
這就是我與--trace
/Users/anderskitson/rails_project/demo_app/Rakefile:1:in `<top (required)>'
/Users/anderskitson/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/Users/anderskitson/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/anderskitson/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/Users/anderskitson/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/Users/anderskitson/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/anderskitson/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/Users/anderskitson/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/Users/anderskitson/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/anderskitson/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/anderskitson/.rvm/gems/[email protected]/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/anderskitson/.rvm/gems/[email protected]/bin/rake:19:in `load'
/Users/anderskitson/.rvm/gems/[email protected]/bin/rake:19:in `<main>'
我跑
個軌生成腳手架用戶名:字符串email:字符串
然後我跑
rake db:migrate
我耙文件看起來像
d# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
DemoApp::Application.load_tasks
你可以添加有問題的遷移到你的問題。 – 2012-02-01 20:46:07
我很抱歉,我不確切地知道您的意思 – 2012-02-01 20:53:03
爲您嘗試運行的遷移添加代碼。 – bensie 2012-02-01 21:02:55