初步为User建模，并执行数据库migrate生成数据库结构和scheme.rb (ch 6.1.1 Database migrations)
这里需要注意的是，虽然scheme.rb是自动生成的，这里也加入git进行管理了
注意到它里面有这样一行注视
# It's strongly recommended to check this file into your version control system.
使用annotate这个gem为modle添加数据库参数注释 (ch 6.1.2 The model file)
ch6.2.1 Initial user tests
6.2.2 Validating presence
长度校验6.2.3 Length validation
校验信箱的格式 6.2.4 Format validation
为email添加index和唯一性验证 (ch 6.2.5 Uniqueness validation)
添加index也可以提升检索性能，因为 based on the naïve data model, the only way to find a user by email address is to look through each user row in the database and compare its email attribute to the given email. This is known in the database business as a full-table scan, and for a real site with thousands of users it is a Bad Thing.

Putting an index on the email column fixes the problem. To understand a database index, it’s helpful to consider the analogy of a book index. In a book, to find all the occurrences of a given string, say “foobar”, you would have to scan each page for “foobar”. With a book index, on the other hand, you can just look up “foobar” in the index to see all the pages containing “foobar”. A database index works essentially the same way.
向user添加password_digest的测试代码和migrate (6.3.1 An encrypted password)
ch 6.3.3 User authentication & ch 6.3.4 User has secure password