確定這是一個足夠簡單的錯誤,我只是無法弄清楚。 我正在安裝ryanto/acts_as_votable gem,並且出現以下問題。 有類似的問題,但我不能找到可以耙分貝之前執行任何修復:遷移rake db:遷移gem時遷移被中止
的Gemfile:
gem 'acts_as_votable', '~> 0.10.0'
那麼我
rails generate acts_as_votable:migration
rake db:migrate
然後耙是中止,我收到此消息
davemc:~/workspace/newsroom (rating) $ rake db:migrate
RubyDep: WARNING: Your Ruby is outdated/buggy.
RubyDep: WARNING: Your Ruby is: 2.3.0 (buggy). Recommendation: upgrade to
2.3.1.
RubyDep: WARNING: (To disable warnings,
see:http://github.com/e2/ruby_dep/wiki/Disabling-warnings)
rake aborted!
NoMethodError: undefined method `resources' for main:Object
/home/ubuntu/workspace/newsroom/config/routes.rb:5:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-
5.1.1/lib/active_support/dependencies.rb:286:in `load'
/usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-
5.1.1/lib/active_support/dependencies.rb:286:in `block in load'
/usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-
5.1.1/lib/active_support/dependencies.rb:258:in `load_dependency'
/usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-
5.1.1/lib/active_support/dependencies.rb:286:in `load'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.1.1/lib/rails/application/routes_reloader.rb:55:in `block in load_paths'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.1.1/lib/rails/application/routes_reloader.rb:55:in `each'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.1.1/lib/rails/application/routes_reloader.rb:55:in `load_paths'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.1.1/lib/rails/application/routes_reloader.rb:18:in `reload!'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.1.1/lib/rails/application/routes_reloader.rb:41:in `block in updater'
/usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-
5.1.1/lib/active_support/file_update_checker.rb:81:in `execute'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.1.1/lib/rails/application/routes_reloader.rb:42:in `updater'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.1.1/lib/rails/application/routes_reloader.rb:31:in `execute_if_updated'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.1.1/lib/rails/application/finisher.rb:128:in `block in <module:Finisher>'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.1.1/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.1.1/lib/rails/initializable.rb:30:in `run'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.1.1/lib/rails/initializable.rb:59:in `block in run_initializers'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.1.1/lib/rails/initializable.rb:58:in `run_initializers'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.1.1/lib/rails/application.rb:353:in `initialize!'
/home/ubuntu/workspace/newsroom/config/environment.rb:5:in `<top
(required)>'
/usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-
5.1.1/lib/active_support/dependencies.rb:292:in `require'
/usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-
5.1.1/lib/active_support/dependencies.rb:292:in `block in require'
/usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-
5.1.1/lib/active_support/dependencies.rb:258:in `load_dependency'
/usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-
5.1.1/lib/active_support/dependencies.rb:292:in `require'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.1.1/lib/rails/application.rb:329:in `require_environment!'
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-
5.1.1/lib/rails/application.rb:445:in `block in run_tasks_blocks'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-12.0.0/exe/rake:27:in `<top
(required)>'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
Routes.rb
Rails.application.routes.draw do
devise_for :users
root to: "posts#index"
end
resources :posts #do
#member do
# put "like" => "posts#upvote"
# put "dislike" => "posts#downvote"
#end
#結束
新的錯誤:
StandardError: An error has occurred, this and all later migrations
anceled:
Directly inheriting from ActiveRecord::Migration is not supported. Please
specify the Rails release the migration was written for:
class ActsAsVotableMigration < ActiveRecord::Migration[4.2]
請將您的路線在這裏提交。 –
這聽起來像是你的寶石想把你的ruby版本升級到2.3.1:'RubyDep:警告:你的Ruby已經過時了/ buggy。 RubyDep:警告:您的Ruby是:2.3.0(越野車)。建議:升級到 2.3.1.' – Jaeger
請仔細閱讀錯誤消息,以便您能答覆。 –