Rails 中的唯一键是如何生成的?
我有一个规格说The backend will have a relational DB, with one table with the following schema: "user : string, password : string, count : int", with user enforced to be non-empty, a unique key.
这是否意味着如果我使用
rails generate scaffold UserModel user:string password:string count:int
将为我生成一个唯一的密钥?默认情况下它会有非空要求吗?
还是我需要
rails generate scaffold UserModel user:string password:string count:int unique_key int