【发布时间】:2014-09-02 09:51:01
【问题描述】:
我按照说明安装了设备。当我做rails generate devise User 时,设计确实生成了 user.rb,但它没有编写设计模块及其必填字段。
它只写在 user.rb 里面
class User
include Mongoid::Document
end
我以前对另一个应用程序也有同样的想法,对于类似的命令,user.rb 填充了这些:
# Include default devise modules. Others available are:
# :confirmable, :lockable, :validatable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :omniauthable
## Database authenticatable
field :email, type: String, default: ""
field :encrypted_password, type: String, default: ""
## Recoverable
field :reset_password_token, type: String
field :reset_password_sent_at, type: Time
## Rememberable
field :remember_created_at, type: Time
## Trackable
field :sign_in_count, type: Integer, default: 0
field :current_sign_in_at, type: Time
field :last_sign_in_at, type: Time
field :current_sign_in_ip, type: String
field :last_sign_in_ip, type: String
## Confirmable
# field :confirmation_token, type: String
# field :confirmed_at, type: Time
# field :confirmation_sent_at, type: Time
# field :unconfirmed_email, type: String # Only if using reconfirmable
## Lockable
# field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
# field :unlock_token, type: String # Only if unlock strategy is :email or :both
# field :locked_at, type: Time
我可能做错了什么?我可能跳过了哪一步?我非常感谢您的帮助。 谢谢
【问题讨论】:
标签: ruby-on-rails devise mongoid