我正在处理rails 4
的Gemfile:
gem "devise", "~> 3.2.2"
CMD:
> rails g devise:install
> rails g devise authorize
> rake db:migrate
错误:
C:\Sites\scroll>rake db:migrate
== DeviseCreateAuthorizes: migrating =========================================
-- create_table(:authorizes)
-> 0.1676s
-- add_index(:authorizes, :email, {:unique=>true})
-> 0.0644s
-- add_index(:authorizes, :reset_password_token, {:unique=>true})
-> 0.0418s
== DeviseCreateAuthorizes: migrated (0.2798s) ================================
rake aborted!
An error has occurred, this and all later migrations canceled:
undefined method `[]' for nil:NilClass
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
包括--trace
rake aborted!
An error has occurred, this and all later migrations canceled:
undefined method `[]' for nil:NilClassF:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/
2.0.0/gems/activerecord- 4.0.2/lib/active_record/attribute_methods/read.rb:86:in`block in read_attribute'
F:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord- 4.0.2/lib/acti
ve_record/attribute_methods/read.rb:84:in `fetch'
F:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.0.2/lib/active_record/attribute_methods/read.rb:84:in `read_attribute'
F:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord- 4.0.2/lib/active_record/attribute_methods.rb:243:in `block in attributes'
F:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord- 4.0.2/lib/active_record/attribute_methods.rb:242:in `each'
F:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.0.2/lib/active_record/attribute_methods.rb:242:in `each_with_object'
F:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.0.2/lib/active_record/attribute_methods.rb:242:in `attributes'
F:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.0.2/lib/active_record/attribute_methods/dirty.rb:84:in`keys_for_partial_write'
F:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.0.2/lib/active_record/attribute_methods/dirty.rb:78:in `create_record'
`<top (required)>'
F:/RailsInstaller/Ruby2.0.0/bin/rake:23:in `load'
F:/RailsInstaller/Ruby2.0.0/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate
迁移:
class DeviseCreateAuthorizes < ActiveRecord::Migration
def change
create_table(:authorizes) do |t|
## Database authenticatable
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, :default => 0, :null => false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token
# t.datetime :confirmed_at
# t.datetime :confirmation_sent_at
# t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
# t.integer :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t.timestamps
end
add_index :authorizes, :email, :unique => true
add_index :authorizes, :reset_password_token, :unique => true
end
end
出了什么问题
感谢。