-
Notifications
You must be signed in to change notification settings - Fork 0
Feature ad making #5
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
base: master
Are you sure you want to change the base?
Conversation
app/jobs/application_job.rb
Outdated
@@ -1,2 +1,3 @@ | |||
# frozen_string_literal: true |
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.
[imo]このファイルはいらないから消して大丈夫
app/helpers/ad_helper.rb
Outdated
@@ -0,0 +1,3 @@ | |||
# frozen_string_literal: true |
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.
[imo]このファイルも消して動作するなら、消してもOK
app/views/ad/edit.html.erb
Outdated
<% end %> | ||
<%= form_for(@ad ,url: "/ad/#{@ad.id}",html: {method: "patch",class: "form-group"}) do |f| %> <%##入稿フォーム %> | ||
<div class="form-group"> | ||
<p>text</p> |
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.
[nits]pタグで囲まれた項目名は日本語で(他箇所も)
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.
[MUST]ここ直ってないよ
test/fixtures/ads.yml
Outdated
@@ -0,0 +1,13 @@ | |||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html |
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.
[nits]RSpec使ってるから、このファイルは消してOK
test/models/ad_test.rb
Outdated
@@ -0,0 +1,8 @@ | |||
# frozen_string_literal: true |
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.
[nits]RSpec使ってるから、このファイルは消してOK
app/controllers/ad_controller.rb
Outdated
flash[:notice] = 'Ad registered!' | ||
redirect_to(ad_index_path) | ||
else | ||
render("ad/new") |
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.
[IMO]パスの書き方
app/controllers/ad_controller.rb
Outdated
flash[:notice] = 'Ad updated!' | ||
redirect_to(ad_index_path) | ||
else | ||
render("ad/edit") |
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.
[IMO]パスの書き方
spec/features/path_spec.rb
Outdated
|
||
describe 'Index Page Path' do | ||
it 'visit index' do | ||
visit '/ad' |
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.
[MUST]パスの書き方をxxx_yyy_pathにして欲しい
d0bfea6
to
ab607ff
Compare
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.
一部コメントした!
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[IMO]ここも、入力必須にしているならnull: false は必要だけどデフォルト値はなくても大丈夫だよ。
@@ -0,0 +1,8 @@ | |||
# frozen_string_literal: true | |||
class AddReportColumnToAds < ActiveRecord::Migration[5.2] | |||
def change |
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.
全体的に
[ask]それぞれの項目は本当にintegerで大丈夫?
[ask]NULL制約、デフォルト値の検討はどうなっていますか?
[ask]これらのカラムはクリックされた結果だったりimpされた結果だったりすると思うけど、これらのカラムをads
に入れた理由を教えてもらえる?
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.
[MUST]これらって結局adsテーブルに残すんだっけ?
db/schema.rb
Outdated
# | ||
# It's strongly recommended that you check this file into your version control system. | ||
|
||
ActiveRecord::Schema.define(version: 2019_06_04_073026) do |
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.
このads
テーブル含めた全体的な設計について、明日質問させて欲しい
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.
[MUST]直ってない
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.
@bbjjki4 直ってない部分が多すぎる。こういったことは2度とないようにしてほしい
app/views/ad/edit.html.erb
Outdated
<% end %> | ||
<%= form_for(@ad ,url: "/ad/#{@ad.id}",html: {method: "patch",class: "form-group"}) do |f| %> <%##入稿フォーム %> | ||
<div class="form-group"> | ||
<p>text</p> |
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.
[MUST]ここ直ってないよ
app/views/ad/index.html.erb
Outdated
<div class="each_ad"> <%# 広告を一つ一つ表示 %> | ||
<% @ads.each do |ad| %> | ||
<li> | ||
<span>ad_id :<%= ad.id %></span> |
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.
[MUST]ここも日本語化
app/views/ad/new.html.erb
Outdated
<%= render partial: "errorlog" %> | ||
<%= form_for(@ad ,url: ad_index_path,html: {method: "post",class: "form-group"}) do |f| %> <%##入稿フォーム %> | ||
<div class="form-group"> | ||
<p>text</p> |
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.
[MUST]ここも
@@ -0,0 +1,8 @@ | |||
# frozen_string_literal: true | |||
class AddReportColumnToAds < ActiveRecord::Migration[5.2] | |||
def change |
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.
[MUST]これらって結局adsテーブルに残すんだっけ?
db/schema.rb
Outdated
# | ||
# It's strongly recommended that you check this file into your version control system. | ||
|
||
ActiveRecord::Schema.define(version: 2019_06_04_073026) do |
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.
[MUST]直ってない
'advertiser_id' => nil, | ||
'image' => nil | ||
}, | ||
id: @ad.id } |
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.
[MUST]インデントおかしい
'advertiser_id' => nil, | ||
'image' => nil | ||
}, | ||
id: @ad.id } |
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.
[MUST]インデントおかしい
spec/features/path_spec.rb
Outdated
visit '/ad/new' | ||
end | ||
|
||
it 'is Forms valid?' do |
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.
[MUST]直ってない
spec/features/path_spec.rb
Outdated
page.attach_file('ad_image', '/Users/hashimototakuma/Downloads/PNG_transparency_demonstration_1.png') | ||
end | ||
|
||
it 'is create action valid?' do |
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.
[MUST]直ってない
f1dcfc2
to
447eca2
Compare
app/controllers/ad_controller.rb
Outdated
@@ -18,7 +18,7 @@ def create | |||
flash[:notice] = 'Ad registered!' |
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.
細かいところだけど修正しておいて
app/controllers/ad_controller.rb
Outdated
redirect_to(ad_index_path) | ||
else | ||
render('ad/new') | ||
render(new_ad_path) |
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.
render('new')
で行けたらそれで
app/views/ad/edit.html.erb
Outdated
<div class="form-group"> | ||
<p>text</p> | ||
<div class="form-group h3"> | ||
<p>広告文</p> |
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.
ここは「テキスト」いいよ
app/views/ad/index.html.erb
Outdated
</thead> | ||
<tbody> | ||
<tr> | ||
<% @ads.each do |ad| %><%# 広告を一つ一つ表示 %> |
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.
コメント不要(処理見れば何やってるかわかる)
app/views/ad/new.html.erb
Outdated
<div class="form-group"> | ||
<p>text</p> | ||
<div class="form-group h3"> | ||
<p>広告文</p> |
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.
@bbjjki4 LGTM! お疲れ。
このブランチはmasterにマージしてください。
その後、別ブランチでコンフリクトが起こっていたら解消して、引き続きデザインを綺麗にしてください。
OJTの広告入稿画面の作成を行いました。
CherryPickやResetを使いながらCommit内容を修正していたため、一部Commit内容が乱雑になっているかもしれません。申し訳ございません。
一通りファイルを確認しましたが、不可解な点が御座いましたらご連絡ください。
対応issue #4