레일에서 고유 키는 어떻게 생성됩니까? 비어 있지 않은 고유 한 키 레일
나는rails generate scaffold UserModel user:string password:string count:int
고유 키 나를 위해 생성됩니다를 사용하는 경우 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 unique_key int
고유 키를 명시 적으로 선언 할 필요가 없습니다. 마이그레이션을 실행하면 자동으로 만들어집니다. 또한 "UserModel"이라는 사용자 모델을 왜 호출하고 있습니까? "사용자"라고 부를 수 있습니다. 그래서'rails g scaffold 사용자 사용자 : 문자열 암호 : 문자열' – Andrei