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

質問・回答アプリ(テーブル設計編)の課題提出 #1

Merged
merged 3 commits into from Dec 2, 2021

Conversation

Shun712
Copy link
Owner

@Shun712 Shun712 commented Nov 28, 2021

質問・回答アプリ(テーブル設計編)の課題提出

テーブル設計のファイルをdesign_table.mdに書きました。
ご確認お願い致します。

蛇足ですが、練習がてらER図も作成しました。
Image from Gyazo

design_table.md Outdated
- id: integer
- name: string
- email: string
- password: string

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にすべきかなと思います。

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

わかりました。

design_table.md Outdated
Comment on lines 16 to 21
- notifications
- id: integer
- question_id: integer
- visitor_id: integer
- visited_id: integer
- checked: integer

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これってどういう用途のテーブルでしょうか?

回答とはまた別でしょうか?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

通知のテーブルを作成しました。
ですが、少々修正を加えました。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

通知って今回の要件にはないと思うんですが、作った意図はなんでしょうか?

また、「回答」がないのが気になります。

Copy link
Owner Author

@Shun712 Shun712 Dec 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

課題要件に

質問があった際に全員に対して質問があった旨をメールで通知する(ただし自分は除く)
質問に対して回答があった場合は質問者および当該質問に回答したユーザーに対してメールで通知する。(ただし自分は除く)

とあり、Railsで通知機能を作る(①基本機能編)を参考に作りました。
ですが、今回削除しました。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるほど。
「メールで通知する」なのでDBに保存する必要はないかなと思います。テーブルを作っても良いとは思いますが、それよりもやはり「answers」を作るという発想が一般的かなと思います。

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ご指摘ありがとうございます。
マージします。

Copy link

@DaichiSaito DaichiSaito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

download

@Shun712 Shun712 merged commit 704af70 into main Dec 2, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants