質問編集履歴
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -41,4 +41,47 @@
|
|
41
41
|
②または、そのほかのテスト方法。
|
42
42
|
|
43
43
|
|
44
|
-
説明が下手で伝わりにくいかもしれませんが、どうかご教授いただければと思います。
|
44
|
+
説明が下手で伝わりにくいかもしれませんが、どうかご教授いただければと思います。
|
45
|
+
|
46
|
+
### 追記
|
47
|
+
```rb
|
48
|
+
#controllers/job_offer_controller.rb
|
49
|
+
def index
|
50
|
+
@company = Company.select("name") #会社名を取得
|
51
|
+
@job_offer = JobOffer.where(group: @company) #groupが会社名
|
52
|
+
end
|
53
|
+
```
|
54
|
+
```rb
|
55
|
+
#views/job_offer/index.html.erb
|
56
|
+
|
57
|
+
<p id="notice"><%= notice %></p>
|
58
|
+
|
59
|
+
<h1>加盟企業の求人一覧</h1>
|
60
|
+
|
61
|
+
<table>
|
62
|
+
<thead>
|
63
|
+
<tr>
|
64
|
+
<th>Title</th>
|
65
|
+
<th>Group</th>
|
66
|
+
<th>Content</th>
|
67
|
+
<th>Url</th>
|
68
|
+
<th colspan="3"></th>
|
69
|
+
</tr>
|
70
|
+
</thead>
|
71
|
+
|
72
|
+
<tbody>
|
73
|
+
<% @job_offer.each do |job_offer| %>
|
74
|
+
<tr>
|
75
|
+
<td><%= job_offer.title %></td>
|
76
|
+
<td><%= job_offer.group %></td>
|
77
|
+
<td><%= job_offer.content %></td>
|
78
|
+
<td><a href="<%= job_offer.url %>"><%= job_offer.url %></a></td>
|
79
|
+
<td><%= link_to 'Show', job_offer %></td>
|
80
|
+
<td><%= link_to 'Edit', edit_job_offer_path(job_offer) %></td>
|
81
|
+
<td><%= link_to 'Destroy', job_offer, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
82
|
+
</tr>
|
83
|
+
<% end %>
|
84
|
+
</tbody>
|
85
|
+
</table> <br>
|
86
|
+
<%= link_to 'New Company', new_job_offer_path %>
|
87
|
+
```
|