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
質問・回答アプリ(テーブル設計編)の課題提出 #1
Conversation
design_table.md
Outdated
- id: integer | ||
- name: string | ||
- email: string | ||
- password: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
passwordだと生のパスワードを保存するように見えてしまいます。
また、has_secure_password
モジュールを利用する場合はpassword_digest
という名前である必要があります。
以上のことからpassword_digest
にすべきかなと思います。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
わかりました。
design_table.md
Outdated
- notifications | ||
- id: integer | ||
- question_id: integer | ||
- visitor_id: integer | ||
- visited_id: integer | ||
- checked: integer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これってどういう用途のテーブルでしょうか?
回答とはまた別でしょうか?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
通知のテーブルを作成しました。
ですが、少々修正を加えました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
通知って今回の要件にはないと思うんですが、作った意図はなんでしょうか?
また、「回答」がないのが気になります。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
課題要件に
質問があった際に全員に対して質問があった旨をメールで通知する(ただし自分は除く)
質問に対して回答があった場合は質問者および当該質問に回答したユーザーに対してメールで通知する。(ただし自分は除く)
とあり、Railsで通知機能を作る(①基本機能編)を参考に作りました。
ですが、今回削除しました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なるほど。
「メールで通知する」なのでDBに保存する必要はないかなと思います。テーブルを作っても良いとは思いますが、それよりもやはり「answers」を作るという発想が一般的かなと思います。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ご指摘ありがとうございます。
マージします。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
質問・回答アプリ(テーブル設計編)の課題提出
テーブル設計のファイルを
design_table.md
に書きました。ご確認お願い致します。
蛇足ですが、練習がてらER図も作成しました。