Skip to content

Feature ad making#5

Open
HashimotoLogly wants to merge 9 commits intomasterfrom
feature_ad-making
Open

Feature ad making#5
HashimotoLogly wants to merge 9 commits intomasterfrom
feature_ad-making

Conversation

@HashimotoLogly
Copy link
Copy Markdown
Owner

OJTの広告入稿画面の作成を行いました。

CherryPickやResetを使いながらCommit内容を修正していたため、一部Commit内容が乱雑になっているかもしれません。申し訳ございません。
一通りファイルを確認しましたが、不可解な点が御座いましたらご連絡ください。

対応issue #4

Comment thread app/jobs/application_job.rb Outdated
@@ -1,2 +1,3 @@
# frozen_string_literal: true
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[imo]このファイルはいらないから消して大丈夫

Comment thread app/helpers/ad_helper.rb
@@ -0,0 +1,3 @@
# frozen_string_literal: true
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[imo]このファイルも消して動作するなら、消してもOK

Comment thread app/views/ad/edit.html.erb Outdated
Comment thread 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>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nits]pタグで囲まれた項目名は日本語で(他箇所も)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MUST]ここ直ってないよ

Comment thread app/views/ad/index.html.erb Outdated
Comment thread test/fixtures/ads.yml Outdated
@@ -0,0 +1,13 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nits]RSpec使ってるから、このファイルは消してOK

Comment thread test/models/ad_test.rb Outdated
@@ -0,0 +1,8 @@
# frozen_string_literal: true
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nits]RSpec使ってるから、このファイルは消してOK

Comment thread app/controllers/ad_controller.rb Outdated
flash[:notice] = 'Ad registered!'
redirect_to(ad_index_path)
else
render("ad/new")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[IMO]パスの書き方

Comment thread app/controllers/ad_controller.rb Outdated
flash[:notice] = 'Ad updated!'
redirect_to(ad_index_path)
else
render("ad/edit")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[IMO]パスの書き方

Comment thread spec/features/path_spec.rb Outdated

describe 'Index Page Path' do
it 'visit index' do
visit '/ad'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MUST]パスの書き方をxxx_yyy_pathにして欲しい

@HashimotoLogly HashimotoLogly force-pushed the feature_ad-making branch 2 times, most recently from d0bfea6 to ab607ff Compare June 11, 2019 07:22
Copy link
Copy Markdown

@tmk-hsn tmk-hsn left a 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
Copy link
Copy Markdown

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[IMO]
画像もバリデーションかけてるならデフォルト値は指定しなくても良いよ〜(not: nullは必要)

参考までに
http://tech.hapicky.com/archives/234

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 # 広告の価格
Copy link
Copy Markdown

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: '' # 広告の説明文
Copy link
Copy Markdown

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
Copy link
Copy Markdown

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に入れた理由を教えてもらえる?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MUST]これらって結局adsテーブルに残すんだっけ?

Comment thread 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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

このadsテーブル含めた全体的な設計について、明日質問させて欲しい

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MUST]直ってない

Copy link
Copy Markdown

@tmk-hsn tmk-hsn left a comment

Choose a reason for hiding this comment

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

@bbjjki4 直ってない部分が多すぎる。こういったことは2度とないようにしてほしい

Comment thread 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>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MUST]ここ直ってないよ

Comment thread app/views/ad/index.html.erb Outdated
<div class="each_ad"> <%# 広告を一つ一つ表示 %>
<% @ads.each do |ad| %>
<li>
<span>ad_id :<%= ad.id %></span>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MUST]ここも日本語化

Comment thread 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>
Copy link
Copy Markdown

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MUST]これらって結局adsテーブルに残すんだっけ?

Comment thread 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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MUST]直ってない

Comment thread spec/controllers/ad_controller_spec.rb Outdated
'advertiser_id' => nil,
'image' => nil
},
id: @ad.id }
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MUST]インデントおかしい

Comment thread spec/controllers/ad_controller_spec.rb Outdated
'advertiser_id' => nil,
'image' => nil
},
id: @ad.id }
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MUST]インデントおかしい

visit '/ad/new'
end

it 'is Forms valid?' do
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MUST]直ってない

page.attach_file('ad_image', '/Users/hashimototakuma/Downloads/PNG_transparency_demonstration_1.png')
end

it 'is create action valid?' do
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MUST]直ってない

Comment thread app/controllers/ad_controller.rb Outdated
@@ -18,7 +18,7 @@ def create
flash[:notice] = 'Ad registered!'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ごめん、レビュー漏れてたけど、メッセージは日本語で登録してほしい
(他箇所も)

Copy link
Copy Markdown

@tmk-hsn tmk-hsn left a comment

Choose a reason for hiding this comment

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

細かいところだけど修正しておいて

Comment thread app/controllers/ad_controller.rb Outdated
redirect_to(ad_index_path)
else
render('ad/new')
render(new_ad_path)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

render('new') で行けたらそれで

Comment thread app/views/ad/edit.html.erb Outdated
<div class="form-group">
<p>text</p>
<div class="form-group h3">
<p>広告文</p>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ここは「テキスト」いいよ

Comment thread app/views/ad/index.html.erb Outdated
</thead>
<tbody>
<tr>
<% @ads.each do |ad| %><%# 広告を一つ一つ表示 %>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

コメント不要(処理見れば何やってるかわかる)

Comment thread app/views/ad/new.html.erb Outdated
<div class="form-group">
<p>text</p>
<div class="form-group h3">
<p>広告文</p>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

「テキスト」でよろしく

Copy link
Copy Markdown

@tmk-hsn tmk-hsn left a comment

Choose a reason for hiding this comment

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

@bbjjki4 LGTM! お疲れ。

このブランチはmasterにマージしてください。
その後、別ブランチでコンフリクトが起こっていたら解消して、引き続きデザインを綺麗にしてください。

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