Ruby on rails错误rake db:migrate

时间:2015-08-31 05:00:37

标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-4 rubygems syntax-error

每当我运行rake $PATH时,它都会返回语法错误

db:migrate RAILS_ENV=development

任务:TOP => DB:迁移 (通过使用--trace运行任务查看完整跟踪)

我检查了所有内容,所有返回的内容都是

rake aborted!
SyntaxError: /Users/IsaiahxD/.rvm/gems/ruby-  2.2.1@rails3tutorial/rails_projects/first_app/db/migrate/20150825050353_create_u    sers.rb:21: syntax error, unexpected keyword_end, expecting end-of-input
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activesupport- 4.2.3/lib/active_support/dependencies.rb:274:in `require'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/migration.rb:773:in `load_migration'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/migration.rb:769:in `migration'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/migration.rb:764:in `disable_ddl_transaction'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/migration.rb:1047:in `use_transaction?'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/migration.rb:1039:in `ddl_transaction'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/migration.rb:993:in `execute_migration_in_transaction'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/migration.rb:955:in `block in migrate'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/migration.rb:951:in `each'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/migration.rb:951:in `migrate'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/migration.rb:819:in `up'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/migration.rb:797:in `migrate'
/Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
 /Users/IsaiahxD/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'

1 个答案:

答案 0 :(得分:3)

变化:

t.timestamps null: false

要:

t.timestamps :null => false