此迁移是从不久前开始的,直到现在才引发问题。我不知道我做错了什么。以下是整个错误消息:
Hiras-MacBook-Pro:seatyourself hirakazmi$
be rake db:migrate rake aborted!
NameError: uninitialized constant UpdateDateOnReservations
/Users/hirakazmi/.rbenv/versions/2.3.1/bin/bundle:22:in `load'
/Users/hirakazmi/.rbenv/versions/2.3.1/bin/bundle:22:in `<main>'
NameError: uninitialized constant UpdateDateOnReservations
/Users/hirakazmi/.rbenv/versions/2.3.1/bin/bundle:22:in `load'
/Users/hirakazmi/.rbenv/versions/2.3.1/bin/bundle:22:in `<main>'
Tasks: TOP => db:migrate (See full trace by running task with --trace)
Hiras-MacBook-Pro:seatyourself hirakazmi$
答案 0 :(得分:2)
我假设您有一个名为db/migrations/20160000000000_update_date_on_reservations.rb
的rails迁移文件。在该文件中,您的类名与文件名不匹配。
该迁移文件应该定义类如下:
class UpdateDateOnReservations < ActiveRecord::Migration
def change
add_column :reservations, :updated_date, :datetime
end
end
如果这不能解答您的问题,请使用--trace
运行您的命令,例如:be rake db:migrate --trace
,并在此处或在要点中发布结果。