您可以为其他字段创建单独的模型/迁移,并将它们链接在一起(特别是在模型中地址可以很好地进行),也可以直接将这些字段添加到设备迁移中。这是我在一个小型大学项目中使用的设计迁移:
def self.up
create_table(:students) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
t.trackable
# t.confirmable
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
# t.token_authenticatable
t.string :name
t.string :studentNumber
t.references :faculty
t.timestamps
end
模型中的相关行:
attr_accessible :studentNumber, :email, :name, :faculty, :password, :password_confirmation