我创建一个简单的用户表,当我跑耙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