Conversation
app/jobs/application_job.rb
Outdated
| @@ -0,0 +1,3 @@ | |||
| # frozen_string_literal: true | |||
app/views/ad/edit.html.erb
Outdated
test/fixtures/ads.yml
Outdated
test/models/ad_test.rb
Outdated
app/controllers/ad_controller.rb
Outdated
app/controllers/ad_controller.rb
Outdated
spec/features/path_spec.rb
Outdated
d0bfea6 to
ab607ff
Compare
| class CreateAds < ActiveRecord::Migration[5.2] | ||
| def change | ||
| create_table :ads do |t| | ||
| t.integer :advertiser_id, null: false, default: 0 # 広告主ID |
There was a problem hiding this comment.
[MUST]
ID系のカラムはdefault 0なしでOKです。
ID = 0 の広告主は間違いなく存在しないので。
デフォルト値自体も、広告単体で(広告主に紐づかない状態で)登録されることはないから指定しないでOK。
ただし、null: falseはいるので注意。
| def change | ||
| create_table :ads do |t| | ||
| t.integer :advertiser_id, null: false, default: 0 # 広告主ID | ||
| t.string :image, null: false, default: '' # 広告の画像URL |
There was a problem hiding this comment.
[IMO]
画像もバリデーションかけてるならデフォルト値は指定しなくても良いよ〜(not: nullは必要)
| create_table :ads do |t| | ||
| t.integer :advertiser_id, null: false, default: 0 # 広告主ID | ||
| t.string :image, null: false, default: '' # 広告の画像URL | ||
| t.integer :price, null: false, default: 0 # 広告の価格 |
There was a problem hiding this comment.
[ask]ここのpriceは具体的にどういう価格なのか、教えてもらってもいい?
[ask]それを踏まえて、広告の価格をデフォルト値0で設定して大丈夫かな?
[IMO]上記の質問に答えてもらった上で、default 0 は削除して大丈夫です
| t.integer :advertiser_id, null: false, default: 0 # 広告主ID | ||
| t.string :image, null: false, default: '' # 広告の画像URL | ||
| t.integer :price, null: false, default: 0 # 広告の価格 | ||
| t.string :text, null: false, default: '' # 広告の説明文 |
There was a problem hiding this comment.
[IMO]ここも、入力必須にしているならnull: false は必要だけどデフォルト値はなくても大丈夫だよ。
There was a problem hiding this comment.
全体的に
[ask]それぞれの項目は本当にintegerで大丈夫?
[ask]NULL制約、デフォルト値の検討はどうなっていますか?
[ask]これらのカラムはクリックされた結果だったりimpされた結果だったりすると思うけど、これらのカラムをadsに入れた理由を教えてもらえる?
db/schema.rb
Outdated
tmk-hsn
left a comment
There was a problem hiding this comment.
@bbjjki4 直ってない部分が多すぎる。こういったことは2度とないようにしてほしい
app/views/ad/edit.html.erb
Outdated
app/views/ad/index.html.erb
Outdated
app/views/ad/new.html.erb
Outdated
db/schema.rb
Outdated
| visit '/ad/new' | ||
| end | ||
|
|
||
| it 'is Forms valid?' do |
| page.attach_file('ad_image', '/Users/hashimototakuma/Downloads/PNG_transparency_demonstration_1.png') | ||
| end | ||
|
|
||
| it 'is create action valid?' do |
f1dcfc2 to
447eca2
Compare
app/controllers/ad_controller.rb
Outdated
There was a problem hiding this comment.
ごめん、レビュー漏れてたけど、メッセージは日本語で登録してほしい
(他箇所も)
app/controllers/ad_controller.rb
Outdated
app/views/ad/edit.html.erb
Outdated
app/views/ad/index.html.erb
Outdated
app/views/ad/new.html.erb
Outdated
tmk-hsn
left a comment
There was a problem hiding this comment.
@bbjjki4 LGTM! お疲れ。
このブランチはmasterにマージしてください。
その後、別ブランチでコンフリクトが起こっていたら解消して、引き続きデザインを綺麗にしてください。
OJTの広告入稿画面の作成を行いました。
CherryPickやResetを使いながらCommit内容を修正していたため、一部Commit内容が乱雑になっているかもしれません。申し訳ございません。
一通りファイルを確認しましたが、不可解な点が御座いましたらご連絡ください。
対応issue #4