From da88770ba109008a67fdaff879d7debdd1363ff6 Mon Sep 17 00:00:00 2001 From: bbjjki4 Date: Thu, 20 Jun 2019 11:58:42 +0900 Subject: [PATCH 1/9] fix path name for rendering --- app/controllers/ad_controller.rb | 4 ++-- spec/features/path_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/ad_controller.rb b/app/controllers/ad_controller.rb index e7c1ade..f345387 100644 --- a/app/controllers/ad_controller.rb +++ b/app/controllers/ad_controller.rb @@ -18,7 +18,7 @@ def create flash[:notice] = 'Ad registered!' redirect_to(ad_index_path) else - render('ad/new') + render(new_ad_path) end end @@ -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 diff --git a/spec/features/path_spec.rb b/spec/features/path_spec.rb index aab875b..68ea898 100644 --- a/spec/features/path_spec.rb +++ b/spec/features/path_spec.rb @@ -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' From c6e61bbd7614222f11fb19c7400e545513781e31 Mon Sep 17 00:00:00 2001 From: bbjjki4 Date: Thu, 20 Jun 2019 17:48:22 +0900 Subject: [PATCH 2/9] delete unused files --- app/jobs/application_job.rb | 3 -- test/application_system_test_case.rb | 6 ---- test/controllers/.keep | 0 test/controllers/ad_controller_test.rb | 40 -------------------------- test/fixtures/.keep | 0 test/fixtures/ads.yml | 13 --------- test/fixtures/files/.keep | 0 test/helpers/.keep | 0 test/integration/.keep | 0 test/mailers/.keep | 0 test/models/.keep | 0 test/models/ad_test.rb | 8 ------ test/system/.keep | 0 test/test_helper.rb | 11 ------- 14 files changed, 81 deletions(-) delete mode 100644 app/jobs/application_job.rb delete mode 100644 test/application_system_test_case.rb delete mode 100644 test/controllers/.keep delete mode 100644 test/controllers/ad_controller_test.rb delete mode 100644 test/fixtures/.keep delete mode 100644 test/fixtures/ads.yml delete mode 100644 test/fixtures/files/.keep delete mode 100644 test/helpers/.keep delete mode 100644 test/integration/.keep delete mode 100644 test/mailers/.keep delete mode 100644 test/models/.keep delete mode 100644 test/models/ad_test.rb delete mode 100644 test/system/.keep delete mode 100644 test/test_helper.rb diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb deleted file mode 100644 index 32fe70b..0000000 --- a/app/jobs/application_job.rb +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: true -class ApplicationJob < ActiveJob::Base -end diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb deleted file mode 100644 index 7ff7b4d..0000000 --- a/test/application_system_test_case.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true -require 'test_helper' - -class ApplicationSystemTestCase < ActionDispatch::SystemTestCase - driven_by :selenium, using: :chrome, screen_size: [1400, 1400] -end diff --git a/test/controllers/.keep b/test/controllers/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/test/controllers/ad_controller_test.rb b/test/controllers/ad_controller_test.rb deleted file mode 100644 index 31b53d3..0000000 --- a/test/controllers/ad_controller_test.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true -require 'test_helper' - -class AdControllerTest < ActionDispatch::IntegrationTest - test 'should get index' do - get ad_index_url - assert_response :success - end - - test 'should get show' do - get ad_show_url - assert_response :success - end - - test 'should get edit' do - get ad_edit_url - assert_response :success - end - - test 'should get new' do - get ad_new_url - assert_response :success - end - - test 'should get create' do - get ad_create_url - assert_response :success - end - - test 'should get edit' do - get ad_edit_url - assert_response :success - end - - test 'should get destroy' do - get ad_destroy_url - assert_response :success - end - -end diff --git a/test/fixtures/.keep b/test/fixtures/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/test/fixtures/ads.yml b/test/fixtures/ads.yml deleted file mode 100644 index 3d12954..0000000 --- a/test/fixtures/ads.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html - -one: - advertiser_id: 1 - image: MyString - price: MyString - text: MyString - -two: - advertiser_id: 1 - image: MyString - price: MyString - text: MyString diff --git a/test/fixtures/files/.keep b/test/fixtures/files/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/test/helpers/.keep b/test/helpers/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/test/integration/.keep b/test/integration/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/test/mailers/.keep b/test/mailers/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/test/models/.keep b/test/models/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/test/models/ad_test.rb b/test/models/ad_test.rb deleted file mode 100644 index c4220fc..0000000 --- a/test/models/ad_test.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true -require 'test_helper' - -class AdTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/system/.keep b/test/system/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/test/test_helper.rb b/test/test_helper.rb deleted file mode 100644 index 58af444..0000000 --- a/test/test_helper.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true -ENV['RAILS_ENV'] ||= 'test' -require_relative '../config/environment' -require 'rails/test_help' - -class ActiveSupport::TestCase - # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. - fixtures :all - - # Add more helper methods to be used by all tests here... -end From 447eca2d6ad05d56175ea3d6d61b0b12cb67959d Mon Sep 17 00:00:00 2001 From: bbjjki4 Date: Fri, 21 Jun 2019 11:48:08 +0900 Subject: [PATCH 3/9] fix texts and db --- app/views/ad/edit.html.erb | 8 +++---- app/views/ad/index.html.erb | 6 ++--- app/views/ad/new.html.erb | 8 +++---- ...20190604073026_add_report_column_to_ads.rb | 8 ------- db/schema.rb | 22 +++++++++---------- 5 files changed, 21 insertions(+), 31 deletions(-) delete mode 100644 db/migrate/20190604073026_add_report_column_to_ads.rb diff --git a/app/views/ad/edit.html.erb b/app/views/ad/edit.html.erb index 8e25f42..15dcd18 100644 --- a/app/views/ad/edit.html.erb +++ b/app/views/ad/edit.html.erb @@ -1,13 +1,13 @@ <%= render partial: "errorlog" %> <%= form_for(@ad ,url: ad_path(@ad),html: {method: "patch",class: "form-group"}) do |f| %> <%##入稿フォーム %>
-

text

+

広告文

<%= f.text_area :text,value: @ad.text,class: "form-control" %> -

price

+

単価

<%= f.number_field :price,value: @ad.price %> -

advertiser_id

+

広告主ID

<%= f.number_field :advertiser_id,value: @ad.advertiser_id %> -

image

+

イメージ

<%= f.file_field :image,value: @ad.image,class: "form-control-file" %> <%= f.submit class: "btn btn-primary",value: "更新" %>
diff --git a/app/views/ad/index.html.erb b/app/views/ad/index.html.erb index 7296a3d..477de32 100644 --- a/app/views/ad/index.html.erb +++ b/app/views/ad/index.html.erb @@ -2,13 +2,13 @@
<%# 広告を一つ一つ表示 %> <% @ads.each do |ad| %>
  • - ad_id :<%= ad.id %> + 広告ID:<%= ad.id %>
  • - text :<%= ad.text %> + 広告文 :<%= ad.text %>
  • - price :<%= ad.price %> + 単価 :<%= ad.price %>
  • <%= image_tag ad.image.to_s %> diff --git a/app/views/ad/new.html.erb b/app/views/ad/new.html.erb index a841e3b..cb36d5b 100644 --- a/app/views/ad/new.html.erb +++ b/app/views/ad/new.html.erb @@ -1,13 +1,13 @@ <%= render partial: "errorlog" %> <%= form_for(@ad ,url: ad_index_path,html: {method: "post",class: "form-group"}) do |f| %> <%##入稿フォーム %>
    -

    text

    +

    広告文

    <%= f.text_area :text,value: @ad.text,class: "form-control" %> -

    price

    +

    単価

    <%= f.number_field :price,value: @ad.price %> -

    advertiser_id

    +

    広告主ID

    <%= f.number_field :advertiser_id,value: @ad.advertiser_id %> -

    image

    +

    イメージ

    <%= f.file_field :image,value: @ad.image,class: "form-control-file" %> <%= f.submit class: "btn btn-primary",value: "入稿" %>
    diff --git a/db/migrate/20190604073026_add_report_column_to_ads.rb b/db/migrate/20190604073026_add_report_column_to_ads.rb deleted file mode 100644 index bf8d75f..0000000 --- a/db/migrate/20190604073026_add_report_column_to_ads.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true -class AddReportColumnToAds < ActiveRecord::Migration[5.2] - def change - add_column :ads, :click, :integer - add_column :ads, :imp, :integer - add_column :ads, :cv, :integer - end -end diff --git a/db/schema.rb b/db/schema.rb index d6923dc..9d33235 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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. @@ -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 From dca848ff0d87aa5b962f17ee56faf3ad74c743bb Mon Sep 17 00:00:00 2001 From: bbjjki4 Date: Fri, 21 Jun 2019 12:08:57 +0900 Subject: [PATCH 4/9] add ad_cotroller_spec.rb --- spec/controllers/ad_controller_spec.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/spec/controllers/ad_controller_spec.rb b/spec/controllers/ad_controller_spec.rb index f8471fd..b0c8576 100644 --- a/spec/controllers/ad_controller_spec.rb +++ b/spec/controllers/ad_controller_spec.rb @@ -58,8 +58,7 @@ 'price' => nil, 'advertiser_id' => nil, 'image' => nil - }, - id: @ad.id } + },id: @ad.id } expect(response).to render_template :edit end @@ -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 @@ -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 From 3359d06e860f43188fcae92dfa6059832889b469 Mon Sep 17 00:00:00 2001 From: bbjjki4 Date: Fri, 21 Jun 2019 12:23:31 +0900 Subject: [PATCH 5/9] fix notification to Japanese --- app/controllers/ad_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/ad_controller.rb b/app/controllers/ad_controller.rb index f345387..5215ee8 100644 --- a/app/controllers/ad_controller.rb +++ b/app/controllers/ad_controller.rb @@ -15,7 +15,7 @@ def new def create @ad = Ad.new(ad_params) if @ad.save # 広告登録成功時 - flash[:notice] = 'Ad registered!' + flash[:notice] = '広告を登録しました!' redirect_to(ad_index_path) else render(new_ad_path) @@ -25,7 +25,7 @@ def create def update @ad = Ad.find(params[:id]) if @ad.update_attributes(ad_params) - flash[:notice] = 'Ad updated!' + flash[:notice] = '広告を更新しました!' redirect_to(ad_index_path) else render(edit_ad_path) @@ -34,7 +34,7 @@ def update def destroy Ad.find(params[:id]).destroy - flash[:notice] = 'Ad deleted!' + flash[:notice] = '広告を削除しました!' redirect_to(ad_index_path) end From a14df479296509c8c53666cbda21a1c18ab11cbe Mon Sep 17 00:00:00 2001 From: bbjjki4 Date: Fri, 21 Jun 2019 15:25:29 +0900 Subject: [PATCH 6/9] fix button name --- app/views/ad/index.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/ad/index.html.erb b/app/views/ad/index.html.erb index 477de32..4a4fd7c 100644 --- a/app/views/ad/index.html.erb +++ b/app/views/ad/index.html.erb @@ -14,14 +14,14 @@ <%= image_tag ad.image.to_s %>
  • - <%= link_to("Edit", edit_ad_path(ad)) %> + <%= link_to("変更", edit_ad_path(ad)) %>
    - <%= link_to("Delete", ad_path(ad) ,method: :delete) %> + <%= link_to("削除", ad_path(ad) ,method: :delete) %>
    <% end %>
    - <%= link_to("New", new_ad_path) %> + <%= link_to("新規作成", new_ad_path) %>
    From 183e85283779d6575bba2d7fcc4a3e20ca063018 Mon Sep 17 00:00:00 2001 From: bbjjki4 Date: Thu, 27 Jun 2019 13:41:28 +0900 Subject: [PATCH 7/9] decorate edit,new,errorlog,index html --- app/views/ad/_errorlog.html.erb | 2 +- app/views/ad/edit.html.erb | 4 +-- app/views/ad/index.html.erb | 56 ++++++++++++++++++++------------- app/views/ad/new.html.erb | 4 +-- 4 files changed, 39 insertions(+), 27 deletions(-) diff --git a/app/views/ad/_errorlog.html.erb b/app/views/ad/_errorlog.html.erb index 4e97c9f..8c7200b 100644 --- a/app/views/ad/_errorlog.html.erb +++ b/app/views/ad/_errorlog.html.erb @@ -1,5 +1,5 @@ <% if @ad.errors.any? %> <% @ad.errors.full_messages.each do |error| %> <%# formが空白だった場合にエラーを表示 %> -
  • <%= error %>
  • +
  • <%= error %>
  • <% end %> <% end %> diff --git a/app/views/ad/edit.html.erb b/app/views/ad/edit.html.erb index 15dcd18..74abe4b 100644 --- a/app/views/ad/edit.html.erb +++ b/app/views/ad/edit.html.erb @@ -1,6 +1,6 @@ <%= render partial: "errorlog" %> <%= form_for(@ad ,url: ad_path(@ad),html: {method: "patch",class: "form-group"}) do |f| %> <%##入稿フォーム %> -
    +

    広告文

    <%= f.text_area :text,value: @ad.text,class: "form-control" %>

    単価

    @@ -9,6 +9,6 @@ <%= f.number_field :advertiser_id,value: @ad.advertiser_id %>

    イメージ

    <%= f.file_field :image,value: @ad.image,class: "form-control-file" %> - <%= f.submit class: "btn btn-primary",value: "更新" %> + <%= f.submit class: "btn btn-primary h2",value: "更新" %>
    <% end %> diff --git a/app/views/ad/index.html.erb b/app/views/ad/index.html.erb index 4a4fd7c..54a191c 100644 --- a/app/views/ad/index.html.erb +++ b/app/views/ad/index.html.erb @@ -1,27 +1,39 @@
    -
    <%# 広告を一つ一つ表示 %> - <% @ads.each do |ad| %> -
  • - 広告ID:<%= ad.id %> -
  • -
  • - 広告文 :<%= ad.text %> -
  • -
  • - 単価 :<%= ad.price %> -
  • -
  • - <%= image_tag ad.image.to_s %> -
  • -
    + + + + + + + + + + + + + + + + <% @ads.each do |ad| %><%# 広告を一つ一つ表示 %> + + + + + + + <% end %> -
    - <%= link_to("新規作成", new_ad_path) %> -
    - + +
    広告ID広告主ID広告文単価イメージ画像操作
    <%= ad.id %><%= ad.advertiser_id %><%= ad.text %><%= ad.price %><%= image_tag ad.image.to_s %>

    <%= link_to("変更", edit_ad_path(ad)) %> - -

    +

    +

    <%= link_to("削除", ad_path(ad) ,method: :delete) %> -

    +

    +
    diff --git a/app/views/ad/new.html.erb b/app/views/ad/new.html.erb index cb36d5b..351c12b 100644 --- a/app/views/ad/new.html.erb +++ b/app/views/ad/new.html.erb @@ -1,6 +1,6 @@ <%= render partial: "errorlog" %> <%= form_for(@ad ,url: ad_index_path,html: {method: "post",class: "form-group"}) do |f| %> <%##入稿フォーム %> -
    +

    広告文

    <%= f.text_area :text,value: @ad.text,class: "form-control" %>

    単価

    @@ -9,6 +9,6 @@ <%= f.number_field :advertiser_id,value: @ad.advertiser_id %>

    イメージ

    <%= f.file_field :image,value: @ad.image,class: "form-control-file" %> - <%= f.submit class: "btn btn-primary",value: "入稿" %> + <%= f.submit class: "btn btn-primary h2",value: "入稿" %>
    <% end %> From 9a83d440e90ff0e0224c6dfe842a0328f0b5163d Mon Sep 17 00:00:00 2001 From: bbjjki4 Date: Thu, 27 Jun 2019 14:25:51 +0900 Subject: [PATCH 8/9] fix edit path & Rspec --- app/controllers/ad_controller.rb | 2 +- db/schema.rb | 17 ++++++++--------- spec/controllers/ad_controller_spec.rb | 8 ++++---- spec/features/path_spec.rb | 6 +++--- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/app/controllers/ad_controller.rb b/app/controllers/ad_controller.rb index 5215ee8..aca678f 100644 --- a/app/controllers/ad_controller.rb +++ b/app/controllers/ad_controller.rb @@ -28,7 +28,7 @@ def update flash[:notice] = '広告を更新しました!' redirect_to(ad_index_path) else - render(edit_ad_path) + render('edit') end end diff --git a/db/schema.rb b/db/schema.rb index 9d33235..f887c36 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,3 +1,4 @@ +# 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. @@ -11,14 +12,12 @@ # It's strongly recommended that you check this file into your version control system. 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 + 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 diff --git a/spec/controllers/ad_controller_spec.rb b/spec/controllers/ad_controller_spec.rb index b0c8576..4cc4a3d 100644 --- a/spec/controllers/ad_controller_spec.rb +++ b/spec/controllers/ad_controller_spec.rb @@ -58,7 +58,7 @@ 'price' => nil, 'advertiser_id' => nil, 'image' => nil - },id: @ad.id } + }, id: @ad.id } expect(response).to render_template :edit end @@ -88,14 +88,14 @@ '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 context 'when something empty' do it 'without text should be rendered' do - patch :update, params: { ad: { 'text' =>nil }, id: @ad.id } + patch :update, params: { ad: { 'text' => nil }, id: @ad.id } expect(response).to render_template :edit end @@ -120,7 +120,7 @@ 'price' => nil, 'advertiser_id' => nil, 'image' => nil - },id: @ad.id } + }, id: @ad.id } expect(response).to render_template :edit end end diff --git a/spec/features/path_spec.rb b/spec/features/path_spec.rb index 68ea898..763b951 100644 --- a/spec/features/path_spec.rb +++ b/spec/features/path_spec.rb @@ -42,7 +42,7 @@ end it 'new valid?' do - click_link('New') + click_link('新規作成') expect(current_path).to eq new_ad_path end end @@ -64,11 +64,11 @@ context 'on Index Page' do it 'edit clickable' do - click_link('Edit') + click_link('変更') end it 'Delete clickable and its action workable' do - expect { click_link 'Delete' }.to change { Ad.count }.by(-1) + expect { click_link '削除' }.to change { Ad.count }.by(-1) end end end From c8826cd6b55c947b9ceb0c45854eccaa7483c17a Mon Sep 17 00:00:00 2001 From: bbjjki4 Date: Thu, 27 Jun 2019 14:52:24 +0900 Subject: [PATCH 9/9] =?UTF-8?q?fix=20from=20=E5=BA=83=E5=91=8A=E6=96=87=20?= =?UTF-8?q?to=20=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88,=20render=20path,=20d?= =?UTF-8?q?elete=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/ad_controller.rb | 2 +- app/views/ad/edit.html.erb | 2 +- app/views/ad/index.html.erb | 4 ++-- app/views/ad/new.html.erb | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/ad_controller.rb b/app/controllers/ad_controller.rb index aca678f..99feb68 100644 --- a/app/controllers/ad_controller.rb +++ b/app/controllers/ad_controller.rb @@ -18,7 +18,7 @@ def create flash[:notice] = '広告を登録しました!' redirect_to(ad_index_path) else - render(new_ad_path) + render('new') end end diff --git a/app/views/ad/edit.html.erb b/app/views/ad/edit.html.erb index 74abe4b..f554292 100644 --- a/app/views/ad/edit.html.erb +++ b/app/views/ad/edit.html.erb @@ -1,7 +1,7 @@ <%= render partial: "errorlog" %> <%= form_for(@ad ,url: ad_path(@ad),html: {method: "patch",class: "form-group"}) do |f| %> <%##入稿フォーム %>
    -

    広告文

    +

    テキスト

    <%= f.text_area :text,value: @ad.text,class: "form-control" %>

    単価

    <%= f.number_field :price,value: @ad.price %> diff --git a/app/views/ad/index.html.erb b/app/views/ad/index.html.erb index 54a191c..068e86c 100644 --- a/app/views/ad/index.html.erb +++ b/app/views/ad/index.html.erb @@ -11,7 +11,7 @@ 広告ID 広告主ID - 広告文 + テキスト 単価 イメージ画像 操作 @@ -19,7 +19,7 @@ - <% @ads.each do |ad| %><%# 広告を一つ一つ表示 %> + <% @ads.each do |ad| %> <%= ad.id %> <%= ad.advertiser_id %> <%= ad.text %> diff --git a/app/views/ad/new.html.erb b/app/views/ad/new.html.erb index 351c12b..fd331f4 100644 --- a/app/views/ad/new.html.erb +++ b/app/views/ad/new.html.erb @@ -1,7 +1,7 @@ <%= render partial: "errorlog" %> <%= form_for(@ad ,url: ad_index_path,html: {method: "post",class: "form-group"}) do |f| %> <%##入稿フォーム %>
    -

    広告文

    +

    テキスト

    <%= f.text_area :text,value: @ad.text,class: "form-control" %>

    単価

    <%= f.number_field :price,value: @ad.price %>