2012-01-15 28 views
8

Tôi đang cố nâng cấp ứng dụng Rails lên 3.2.0.rc2 nhưng khi tôi cố gắng thực hiện rake db:migrate --trace tôi bây giờ nhận được thông báo lỗi sau:Không biết cách tạo công việc 'db: di chuyển' w/Rails 3.2.0.rc2

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/[email protected]/gems/rake-0.9.2.2/lib/rake/task_manager.rb:49:in `[]' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:115:in `invoke_task' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling' 
/Users/Kyle/.rvm/gems/[email protected]kateparks/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run' 
/Users/Kyle/.rvm/gems/[email protected]/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>' 
/Users/Kyle/.rvm/gems/[email protected]/bin/rake:19:in `load' 
/Users/Kyle/.rvm/gems/[email protected]/bin/rake:19:in `<main>' 

cảnh báo deprecation có vẻ là liên quan đến dòng này trong application.rb:

Bundler.require(:default, :assets, Rails.env) if defined?(Bundler) 

đây có phải là nghĩa vụ phải được xóa hoặc thay đổi trong phiên bản mới nhất của Rails? Tôi đã thử xóa dòng này và chạy lại di chuyển. Sau đó tôi không còn nhận được cảnh báo nhưng vẫn gặp lỗi Don't know how to build task 'db:migrate'. Bất kỳ ý tưởng?

Làm một bundle exec rake -T mang lại như sau:

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 

Nó sẽ xuất hiện như là nếu tất cả rake db nhiệm vụ của tôi đang thiếu.

+0

những gì hiện bundle exec rake-nói? – phoet

+0

Cập nhật câu hỏi của tôi với kết quả đầu ra. Nó xuất hiện tất cả các nhiệm vụ 'rake db' bị thiếu. –

+3

Bạn có thực hiện một yêu cầu 'đường ray'/all'' trong ứng dụng của bạn.rb hoặc bạn đang tải một tập con? –

Trả lời

14

Có điều gì đó rất thú vị đang diễn ra với phiên bản đá quý của bạn. Nếu bạn nhìn vào gemfile.lock của bạn, nó sử dụng các phiên bản 3.2.rc2 của railties, activesupport và activemodel nhưng các phiên bản khác là tất cả các nơi (ar là 1,6, action mailer là 0.6.1 etc).

Tôi không chắc chắn bạn vào trạng thái này như thế nào, nhưng tôi sẽ thử bundle update hoặc xóa Gemfile.lock và sau đó chạy bundle install (trong lý thuyết 2 tương đương) và chỉ định phiên bản chính xác của đường ray bạn muốn (đặc biệt là bạn đang theo sau một phiên bản đường ray phát hành trước.)

+0

Điều này dường như đang xảy ra vì tôi không chỉ định rõ ràng '3.2.0.rc2' trong Gemfile của tôi. Tôi cho rằng chỉ cần đặt 'gem rails' là đủ nhưng tôi đoán là không. Đây có phải là một lỗi w/Rails? –

+0

Nếu đó là một lỗi trong bất cứ điều gì nó sẽ được trong bundler. Điều đó nói rằng nghiêm chỉnh nói rằng các bộ đá quý đã được chọn làm phù hợp với gemfile của bạn (có thể vì một số phiên bản cũ hơn thoải mái hơn về các phiên bản được chỉ định) –

+0

Xóa Gemfile.lock + bundle install hoạt động hoàn hảo. Chúc mừng. –

5

Từ lệnh rake db:migrate --trace, các tác vụ cào không được tải. , bạn không thể có được kế hoạch đường dẫn đúng. và chạy rake -T danh sách cục bộ db:migrate là một trong các tác vụ rake? Nếu không, đường ray của bạn bị định cấu hình sai ... tốt, tôi đã không làm việc với đường ray 3.2.0rc2, nhưng tôi đã tìm kiếm và tìm thấy một số liên kết. Vui lòng tham khảo liên kết bên dưới đây sẽ giúp bạn ..

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

Hãy cho tôi biết làm thế nào nó làm việc!

Cảm ơn Frederick, bài đăng thú vị của nó ..

+1

Cảm ơn, cho câu trả lời này. Nó làm việc cho tôi. – gsoni

Các vấn đề liên quan