不知道如何构建任务“db:migrate”带 Rails 3.2.0.rc2
我正在尝试将 Rails 应用程序升级到 3.2.0.rc2,但是当我尝试执行 rake db:migrate --trace
时,我现在收到以下错误消息:
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionController::Base instead. (called from <top (required)> at /Users/Kyle/Desktop/skateparks-web/config/application.rb:4)
rake aborted!
Don't know how to build task 'db:migrate'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/task_manager.rb:49:in `[]'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:115:in `invoke_task'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/bin/rake:19:in `load'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/bin/rake:19:in `<main>'
弃用警告似乎关于 application.rb 中的这一行:
Bundler.require(:default, :assets, Rails.env) if defined?(Bundler)
这是否应该在最新版本的 Rails 中删除或更改?我尝试删除此行,然后再次运行迁移。然后我不再收到警告,但仍然收到不知道如何构建任务'db:migrate'
错误。有什么想法吗?
执行 bundle exec rake -T
会产生以下结果:
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionController::Base instead. (called from <top (required)> at /Users/Kyle/Desktop/skateparks-web/config/application.rb:4)
rake about # List versions of all Rails frameworks and the environment
rake assets:clean # Remove compiled assets
rake assets:precompile # Compile all the assets named in config.assets.precompile
rake cron # This task is called by the Heroku cron add-on
rake doc:app # Generate docs for the app -- also available doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/...
rake friendlyid:rebuild # Updates all User and Skatepark friendly IDs
rake geocode:all # Geocode all objects without coordinates.
rake jobs:work # Alias for resque:work (To run workers on Heroku)
rake log:clear # Truncates all *.log files in log/ to zero bytes
rake middleware # Prints out your Rack middleware stack
rake notes # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)
rake notes:custom # Enumerate a custom annotation, specify with ANNOTATION=CUSTOM
rake rails:template # Applies the template supplied by LOCATION=(/path/to/template) or URL
rake rails:update # Update configs and some other initially generated files (or use just update:configs, update:scripts...
rake resque:scheduler # Start Resque Scheduler
rake resque:work # Start a Resque worker
rake resque:workers # Start multiple Resque workers.
rake routes # Print out all defined routes in match order, with names.
rake secret # Generate a cryptographically secure secret key (this is typically used to generate a secret for coo...
rake sorcery:bootstrap # Adds sorcery's initializer file
rake spec # Run all specs in spec directory (excluding plugin specs)
rake spec:controllers # Run the code examples in spec/controllers
rake spec:helpers # Run the code examples in spec/helpers
rake spec:lib # Run the code examples in spec/lib
rake spec:mailers # Run the code examples in spec/mailers
rake spec:models # Run the code examples in spec/models
rake spec:rcov # Run all specs with rcov
rake spec:requests # Run the code examples in spec/requests
rake spec:routing # Run the code examples in spec/routing
rake spec:views # Run the code examples in spec/views
rake stats # Report code statistics (KLOCs, etc) from the application
rake sunspot:reindex[batch_size,models] # Reindex all solr models that are located in your application's models directory.
rake sunspot:solr:run # Run the Solr instance in the foreground
rake sunspot:solr:start # Start the Solr instance
rake sunspot:solr:stop # Stop the Solr instance
rake test # Runs test:units, test:functionals, test:integration together (also available: test:benchmark, test:...
rake test:recent # Run tests for {:recent=>"test:prepare"} / Test recent changes
rake test:single # Run tests for {:single=>"test:prepare"}
rake test:uncommitted # Run tests for {:uncommitted=>"test:prepare"} / Test changes since last checkin (only Subversion and...
rake time:zones:all # Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET para...
rake tmp:clear # Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tm...
rake tmp:create # Creates tmp directories for sessions, cache, sockets, and pids
看起来好像我的所有 rake db
任务都丢失了。
I'm attempting to upgrade my Rails application to 3.2.0.rc2 but When I try to do a rake db:migrate --trace
I'm now getting the following error message:
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionController::Base instead. (called from <top (required)> at /Users/Kyle/Desktop/skateparks-web/config/application.rb:4)
rake aborted!
Don't know how to build task 'db:migrate'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/task_manager.rb:49:in `[]'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:115:in `invoke_task'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/bin/rake:19:in `load'
/Users/Kyle/.rvm/gems/ruby-1.9.2-p290@skateparks/bin/rake:19:in `<main>'
The deprecation warning seems to be in regards to this line in application.rb
:
Bundler.require(:default, :assets, Rails.env) if defined?(Bundler)
Is this supposed to be removed or changed in the latest version of Rails? I tried removing this line, and running the migrate again. I then no longer get the warning but still get the Don't know how to build task 'db:migrate'
error. Any ideas?
Doing a bundle exec rake -T
yields the following:
DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in ActionController::Base instead. (called from <top (required)> at /Users/Kyle/Desktop/skateparks-web/config/application.rb:4)
rake about # List versions of all Rails frameworks and the environment
rake assets:clean # Remove compiled assets
rake assets:precompile # Compile all the assets named in config.assets.precompile
rake cron # This task is called by the Heroku cron add-on
rake doc:app # Generate docs for the app -- also available doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/...
rake friendlyid:rebuild # Updates all User and Skatepark friendly IDs
rake geocode:all # Geocode all objects without coordinates.
rake jobs:work # Alias for resque:work (To run workers on Heroku)
rake log:clear # Truncates all *.log files in log/ to zero bytes
rake middleware # Prints out your Rack middleware stack
rake notes # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)
rake notes:custom # Enumerate a custom annotation, specify with ANNOTATION=CUSTOM
rake rails:template # Applies the template supplied by LOCATION=(/path/to/template) or URL
rake rails:update # Update configs and some other initially generated files (or use just update:configs, update:scripts...
rake resque:scheduler # Start Resque Scheduler
rake resque:work # Start a Resque worker
rake resque:workers # Start multiple Resque workers.
rake routes # Print out all defined routes in match order, with names.
rake secret # Generate a cryptographically secure secret key (this is typically used to generate a secret for coo...
rake sorcery:bootstrap # Adds sorcery's initializer file
rake spec # Run all specs in spec directory (excluding plugin specs)
rake spec:controllers # Run the code examples in spec/controllers
rake spec:helpers # Run the code examples in spec/helpers
rake spec:lib # Run the code examples in spec/lib
rake spec:mailers # Run the code examples in spec/mailers
rake spec:models # Run the code examples in spec/models
rake spec:rcov # Run all specs with rcov
rake spec:requests # Run the code examples in spec/requests
rake spec:routing # Run the code examples in spec/routing
rake spec:views # Run the code examples in spec/views
rake stats # Report code statistics (KLOCs, etc) from the application
rake sunspot:reindex[batch_size,models] # Reindex all solr models that are located in your application's models directory.
rake sunspot:solr:run # Run the Solr instance in the foreground
rake sunspot:solr:start # Start the Solr instance
rake sunspot:solr:stop # Stop the Solr instance
rake test # Runs test:units, test:functionals, test:integration together (also available: test:benchmark, test:...
rake test:recent # Run tests for {:recent=>"test:prepare"} / Test recent changes
rake test:single # Run tests for {:single=>"test:prepare"}
rake test:uncommitted # Run tests for {:uncommitted=>"test:prepare"} / Test changes since last checkin (only Subversion and...
rake time:zones:all # Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET para...
rake tmp:clear # Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tm...
rake tmp:create # Creates tmp directories for sessions, cache, sockets, and pids
It would appear as if all of my rake db
tasks are missing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的 gem 版本发生了一些非常时髦的事情。如果你看一下 gemfile.lock,它使用的是 3.2.rc2 版本的railties、activesupport 和 activemodel,但其他版本到处都是(ar 是1.6,action mailer 是0.6.1 等)。
我不确定你是如何进入这种状态的,但我会尝试
bundle update
或删除 Gemfile.lock,然后运行 bundle install
(理论上这两个是等效)并指定您想要的 Rails 的精确版本(特别是当您使用 Rails 的预发行版本时。)There is something very funky going on with your gem versions. If you look at your gemfile.lock it's using the 3.2.rc2 versions of railties, activesupport and activemodel but the other versions are all over the place ( ar is 1.6, action mailer is 0.6.1 etc).
I'm not sure how you got into this state, but I'd try either
bundle update
or deleting Gemfile.lock and then runningbundle install
(in theory those 2 are equivalent) and specifying the precise version of rails you want (especially as you're after a prerelease version of rails.)从命令 rake db:migrate --trace 中,未加载 rake 任务。 ,amd 您无法获得正确的路径方案。
并在本地运行
rake -T
将db:migrate
列为 rake 任务之一?如果不,你的rails配置错误......
好吧,我没有使用过 Rails 3.2.0rc2,但我用谷歌搜索并找到了一些链接。
请参考下面的链接,这会对您有所帮助。
Rake db:migrate错误不知道如何构建任务
不知道如何在 Ubuntu natty 上构建 rake db:migrate
运行 rake db:migrate 时出现问题
让我知道它是如何工作的!
谢谢弗雷德里克,它的有趣的帖子..
From the command
rake db:migrate --trace
, the rake tasks are not loaded. , amd you couldn't get the path scheme right.and running
rake -T
locally listdb:migrate
as one of the rake tasks? Ifnot, your rails is misconfigured...
well, I didn't worked with rails 3.2.0rc2 ,but I googled and found some links .
Please refer links below this would help you..
Rake db:migrate error don't know how to build task
Don't know how to build rake db:migrate on Ubuntu natty
Problem running rake db:migrate
Let me know how it worked !
Thanks Frederick, Its interesting post..