Ruby rails 错误耙 db:migrate
Ruby on rails error rake db:migrate
每当我 运行 耙 db:migrate RAILS_ENV=development
它 returns 语法错误
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)>'
任务:顶部 => db:migrate
(使用 --trace 查看 运行ning 任务的完整跟踪)
我检查了所有内容 returns
"20150825050353_create_users.rb:21: syntax error, unexpected keyword_end, expecting end-of-input"
class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.column "first_name", :string, :limit => 25
t.string "last_name", :limit => 50
t.string "email", :default => "", :null => false
t.string "password", :limit => 40
t.datetime "created_at"
t.datetime "updated_at"
t.timestamps null: false
end
end
def down
drop_table :users
end
end
变化:
t.timestamps null: false
收件人:
t.timestamps :null => false
每当我 运行 耙 db:migrate RAILS_ENV=development
它 returns 语法错误
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)>'
任务:顶部 => db:migrate (使用 --trace 查看 运行ning 任务的完整跟踪)
我检查了所有内容 returns
"20150825050353_create_users.rb:21: syntax error, unexpected keyword_end, expecting end-of-input"
class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.column "first_name", :string, :limit => 25
t.string "last_name", :limit => 50
t.string "email", :default => "", :null => false
t.string "password", :limit => 40
t.datetime "created_at"
t.datetime "updated_at"
t.timestamps null: false
end
end
def down
drop_table :users
end
end
变化:
t.timestamps null: false
收件人:
t.timestamps :null => false