我在执行 rake db:migrate 部分时遇到了这个错误。我正在关注 Michael Hartl 教程,此时我似乎迷失了方向,并且一直在尝试许多在线可用的解决方案,但它们似乎并没有太大的帮助。我不知道如何解决这个问题。我是一个完全的新手。难道我做错了什么?你能指出哪里吗?顺便说一句,这是我正在创建的第一个模型。
bundle exec rake db:migrate
DEPRECATION WARNING: config.whiny_nils option is deprecated and no longer works. (called from block in <top (required)> at /home/aravind/coderor/demo_app1/config/environments/development.rb:10)
DEPRECATION WARNING: Model based mass assignment security has been extracted out of Rails into a gem. Please use the new recommended protection model for params or add `protected_attributes` to your Gemfile to use the old one.
To disable this message remove the `whitelist_attributes` option from your
`config/application.rb` file and any `mass_assignment_sanitizer` options
from your `config/environments/*.rb` files.
See http://guides.rubyonrails.org/security.html#mass-assignment for more information.
DEPRECATION WARNING: The Active Record auto explain feature has been removed.
To disable this message remove the `active_record.auto_explain_threshold_in_seconds`
option from the `config/environments/*.rb` config file.
See http://guides.rubyonrails.org/4_0_release_notes.html for more information.
== CreateUsers: migrating ====================================================
-- create_table(:users)
rake aborted!
An error has occurred, this and all later migrations canceled:
private method `String' called for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x00000004606298>/home/aravind /coderor /demo_app1/db/migrate/20130628051457_create_users.rb:4:in `block in change'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:184:in `create_table'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:625:in `block in method_missing'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:597:in `block in say_with_time'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:597:in `say_with_time'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:617:in `method_missing'
/home/aravind/coderor/demo_app1/db/migrate/20130628051457_create_users.rb:3:in `change'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:571:in `exec_migration'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:555:in `block (2 levels) in migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:554:in `block in migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:553:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:709:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:959:in `block in execute_migration_in_transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:1005:in `block in ddl_transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `block in transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:210:in `within_new_transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract /database_statements.rb:202:in `transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/transactions.rb:209:in `transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:1005:in `ddl_transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:958:in `execute_migration_in_transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:920:in `block in migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:916:in `each'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:916:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:764:in `up'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/migration.rb:742:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/railties /databases.rake:42:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
这是迁移文件
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.String :name
t.String :email
t.timestamps
end
end
end