当我在ruby中迁移数据库时,我得到了以下错误

时间:2014-11-12 08:00:11

标签: ruby-on-rails database

rake aborted!
ActiveRecord::StatementInvalid: Mysql2::Error: Table 'edu1.roles' doesn't exist: SHOW FULL FIELDS FROM `roles`
/var/www/html/course/app/models/user.rb:12:in `<class:User>'
/var/www/html/course/app/models/user.rb:1:in `<top (required)>'
/var/www/html/course/config/routes.rb:4:in `block in <top (required)>'
/var/www/html/course/config/routes.rb:1:in `<top (required)>'
/var/www/html/course/config/environment.rb:5:in `<top (required)>'
Mysql2::Error: Table 'edu1.roles' doesn't exist
/var/www/html/course/app/models/user.rb:12:in `<class:User>'
/var/www/html/course/app/models/user.rb:1:in `<top (required)>'
/var/www/html/course/config/routes.rb:4:in `block in <top (required)>'
/var/www/html/course/config/routes.rb:1:in `<top (required)>'
/var/www/html/course/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

my roots .rb

Rails.application.routes.draw do

  get '/courses/all', to: 'courses#index_all'
  resources :courses

  patch 'courses/:id/enroll', to: 'courses#enroll', as: 'enroll_course'

  get 'categories/:category', to: 'courses#index', as: 'category'

  mount Upmin::Engine => '/admin'
  root to: 'visitors#index'
  devise_for :users
  resources :users
end

0 个答案:

没有答案