Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

answerモデルの作成 #10

Open
9 tasks
t-tonchim opened this issue Jan 21, 2016 · 3 comments
Open
9 tasks

answerモデルの作成 #10

t-tonchim opened this issue Jan 21, 2016 · 3 comments

Comments

@t-tonchim
Copy link
Member

マイグレーションの制約とバリデーションもお願いします。

TODO

マイグレーション時の制約・型


answer_text

  • t.string : not_null

right_or_wrong

  • boolean :not_null

quiz_id

  • quizsのidにFKつける

バリデーション


answer_text

  • length: { in: 1..30 }
  • presence :true

right_or_wrong

  • presence :true
  • 4拓とかの時にtrueが必ず一つだけになるような制約つける
    uniqueに if optionとか使ってメソッド作ったりとかでいけるかな??

quiz_id

  • belongs_to :quiz_id
  • presence :true
@masahiro-yamazaki
Copy link
Contributor

山崎担当

@masahiro-yamazaki
Copy link
Contributor

rails generate model Answer answer_text:string right_or_wrong:boolean quiz:belongs_to

@masahiro-yamazaki
Copy link
Contributor

以下のレビューをお願いします。
#27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants