Skip to content

Answer by sanfrecce-osaka - #12

Open
sanfrecce-osaka wants to merge 5 commits into
JunichiIto:mainfrom
sanfrecce-osaka:answer_by_sanfrecce_osaka
Open

Answer by sanfrecce-osaka#12
sanfrecce-osaka wants to merge 5 commits into
JunichiIto:mainfrom
sanfrecce-osaka:answer_by_sanfrecce_osaka

Conversation

@sanfrecce-osaka

Copy link
Copy Markdown

sanfrecce-osakaです。
レビューよろしくお願いします。

感想

rails力の足りなさを痛感しました。
6時間はかかりすぎ・・・。
すごく勉強になりました。

設問について

Ex.3
同じ駅で降りた場合とそれ以外の場合の判定を三項演算子で一行で簡潔に書けた・・・つもりだったんですが少し読みづらくなってしまったかも・・・。

Ex.4
belongs_toをきちんと理解していなかったせいで一つ余分な処理が入ってしまいました・・・。

Ex.5
保存済みのレコードにexited_gate_idが登録されているかどうかで判定しています。
ただblank?を使うべきだったかも・・・。

Comment thread app/models/gate.rb
true
entered_gate = Gate.find(ticket.entered_gate_id)
section = (self.station_number - entered_gate.station_number).abs
(section != 0) ? (ticket.fare >= FARES[section - 1]) : false

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

section > 0 && ticket.fare >= FARES[section - 1]

@JunichiIto

Copy link
Copy Markdown
Owner

すでにチェック済みかもしれませんが、こちらの動画でコメントさせてもらいました!
よろしくお願いします。

【前編】全部見ます!プロを目指すRailsエンジニアのための公開コードレビュー #railsdm - YouTube
https://www.youtube.com/watch?v=xZk4f4PPUhU&t=1s

【後編】全部見ます!プロを目指すRailsエンジニアのための公開コードレビュー #railsdm - YouTube
https://www.youtube.com/watch?v=yDxg0sXHXOo

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.

2 participants