我在執行rake db:migrate部分時遇到此錯誤。我正在關注邁克爾哈特爾的教程,我似乎在這一點上迷失了方向,並嘗試了很多在線的解決方案,但他們似乎沒有太多的幫助。我不知道如何解決這個問題。我是一個總新手。難道我做錯了什麼?你能指出哪裏?順便說一下,這是我創建的第一個模型。無法執行rake:db命令成功
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
,你能告訴我們您的遷移文件? – Huy