質問編集履歴

2

players/search.html.erbのコードを一部変更

2023/01/15 22:01

投稿

masakingu
masakingu

スコア11

test CHANGED
File without changes
test CHANGED
@@ -83,24 +83,26 @@
83
83
  <div class="row">
84
84
  <div class="col-lg-8 offset-lg-2">
85
85
  <div class="player">
86
- <%= form_with url: search_players_path, method: :get, local: true do |f| %>//<div class="form-group">
86
+ <%= form_with url: search_players_path, method: :get, local: true do |f| %>
87
+ <div class="form-group">
87
- <%
88
+ <h1>プレイヤー検索</h1>
88
-
89
- <%= f.text_field :season, class: 'form-control', placeholder: '西暦を入力してください(例:1997)' %>
89
+ <%= f.text_field :season, class: 'form-control', placeholder: '西暦を入力してください(例: 1997)' %>
90
90
 
91
91
  <div class="search2 ">
92
92
  <%= f.text_field :player_name, class: 'form-control', placeholder: '選手名を入力してください' %>
93
93
  <%= f.submit '検索', class: 'btn btn-primary' %>
94
94
  </div>
95
95
  </div>
96
- <% if @players.present? %>
96
+ <% if @player_name.present? %>
97
- <%= render partial: 'players/player' %>
97
+ <%= render 'players/player' %>
98
98
  <% end %>
99
99
  <% end %>
100
100
  </div>
101
101
  </div>
102
102
  </div>
103
103
  </div>
104
+
105
+
104
106
  ```
105
107
  _player.html.erb
106
108
  ```

1

コメントを消しました。

2023/01/13 18:44

投稿

masakingu
masakingu

スコア11

test CHANGED
File without changes
test CHANGED
@@ -37,8 +37,7 @@
37
37
  before_action :set_q, only: %i[search]
38
38
 
39
39
  def search
40
- #url = URI.parse("https://api-football-v1.p.rapidapi.com/v2/players/search/{lastname}")
41
- url = URI.parse('https://api-football-v1.p.rapidapi.com/v3/players?team=85&search=cavani')
40
+ url = URI.parse('https://api-football-v1p.rapidapi.com/v3/players?team=85&search=cavani')
42
41
 
43
42
  http = Net::HTTP.new(url.host, url.port)
44
43
  http.use_ssl = true