Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/controllers/ad_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.

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

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') で行けたらそれで

end
end

Expand All @@ -28,7 +28,7 @@ def update
flash[:notice] = 'Ad updated!'
redirect_to(ad_index_path)
else
render('ad/edit')
render(edit_ad_path)
end
end

Expand Down
3 changes: 0 additions & 3 deletions app/jobs/application_job.rb

This file was deleted.

8 changes: 4 additions & 4 deletions app/views/ad/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<%= render partial: "errorlog" %>
<%= form_for(@ad ,url: ad_path(@ad),html: {method: "patch",class: "form-group"}) do |f| %> <%##入稿フォーム %>
<div class="form-group">
<p>text</p>
<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.

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

<%= f.text_area :text,value: @ad.text,class: "form-control" %>
<p>price</p>
<p>単価</p>
<%= f.number_field :price,value: @ad.price %>
<p>advertiser_id</p>
<p>広告主ID</p>
<%= f.number_field :advertiser_id,value: @ad.advertiser_id %>
<p>image</p>
<p>イメージ</p>
<%= f.file_field :image,value: @ad.image,class: "form-control-file" %>
<%= f.submit class: "btn btn-primary",value: "更新" %>
</div>
Expand Down
6 changes: 3 additions & 3 deletions app/views/ad/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<div class="each_ad"> <%# 広告を一つ一つ表示 %>
<% @ads.each do |ad| %>
<li>
<span>ad_id :<%= ad.id %></span>
<span>広告ID:<%= ad.id %></span>
</li>
<li>
<span>text :<%= ad.text %></span>
<span>広告文 :<%= ad.text %></span>
</li>
<li>
<span>price :<%= ad.price %></span>
<span>単価 :<%= ad.price %></span>
</li>
<li>
<%= image_tag ad.image.to_s %>
Expand Down
8 changes: 4 additions & 4 deletions app/views/ad/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<%= 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>
<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.

「テキスト」でよろしく

<%= f.text_area :text,value: @ad.text,class: "form-control" %>
<p>price</p>
<p>単価</p>
<%= f.number_field :price,value: @ad.price %>
<p>advertiser_id</p>
<p>広告主ID</p>
<%= f.number_field :advertiser_id,value: @ad.advertiser_id %>
<p>image</p>
<p>イメージ</p>
<%= f.file_field :image,value: @ad.image,class: "form-control-file" %>
<%= f.submit class: "btn btn-primary",value: "入稿" %>
</div>
Expand Down
8 changes: 0 additions & 8 deletions db/migrate/20190604073026_add_report_column_to_ads.rb

This file was deleted.

22 changes: 10 additions & 12 deletions db/schema.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# frozen_string_literal: true
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
Expand All @@ -11,16 +10,15 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2019_06_04_073026) do
create_table 'ads', force: :cascade do |t|
t.integer 'advertiser_id', default: 0, null: false
t.string 'image', default: '', null: false
t.integer 'price', default: 0, null: false
t.string 'text', default: '', null: false
t.datetime 'created_at', null: false
t.datetime 'updated_at', null: false
t.integer 'click'
t.integer 'imp'
t.integer 'cv'
ActiveRecord::Schema.define(version: 2019_05_28_085221) do

create_table "ads", force: :cascade do |t|
t.integer "advertiser_id", default: 0, null: false
t.string "image", default: "", null: false
t.integer "price", default: 0, null: false
t.string "text", default: "", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

end
9 changes: 3 additions & 6 deletions spec/controllers/ad_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
'price' => nil,
'advertiser_id' => nil,
'image' => nil
},
id: @ad.id }
},id: @ad.id }
expect(response).to render_template :edit
end

Expand Down Expand Up @@ -89,8 +88,7 @@
'price' => 1010101,
'advertiser_id' => 1010101,
'image' => Rack::Test::UploadedFile.new(File.join(Rails.root, 'spec/fixture/image.jpg'))
},
id: @ad.id }
},id: @ad.id }
expect(response).to redirect_to(ad_index_path)
end
end
Expand Down Expand Up @@ -122,8 +120,7 @@
'price' => nil,
'advertiser_id' => nil,
'image' => nil
},
id: @ad.id }
},id: @ad.id }
expect(response).to render_template :edit
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/path_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
describe 'Buttons' do
context 'after new ad created' do
before do
visit 'ad/new'
visit new_ad_path
fill_in 'ad_text', with: 'TextForm'
fill_in 'ad_price', with: '1000'
fill_in 'ad_advertiser_id', with: '1'
Expand Down
6 changes: 0 additions & 6 deletions test/application_system_test_case.rb

This file was deleted.

Empty file removed test/controllers/.keep
Empty file.
40 changes: 0 additions & 40 deletions test/controllers/ad_controller_test.rb

This file was deleted.

Empty file removed test/fixtures/.keep
Empty file.
13 changes: 0 additions & 13 deletions test/fixtures/ads.yml

This file was deleted.

Empty file removed test/fixtures/files/.keep
Empty file.
Empty file removed test/helpers/.keep
Empty file.
Empty file removed test/integration/.keep
Empty file.
Empty file removed test/mailers/.keep
Empty file.
Empty file removed test/models/.keep
Empty file.
8 changes: 0 additions & 8 deletions test/models/ad_test.rb

This file was deleted.

Empty file removed test/system/.keep
Empty file.
11 changes: 0 additions & 11 deletions test/test_helper.rb

This file was deleted.