質問編集履歴
2
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,7 +8,31 @@
|
|
8
8
|
|
9
9
|
### 発生している問題・エラーメッセージ
|
10
10
|
|
11
|
-
|
11
|
+
```routes
|
12
|
+
|
13
|
+
Rails.application.routes.draw do
|
14
|
+
|
15
|
+
devise_for :users
|
16
|
+
|
17
|
+
root to: 'homes#top'
|
18
|
+
|
19
|
+
get 'home/about' => 'homes#index'
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
resources :books,only:[:new,:create,:index,:show,:destroy,:edit,:update]do
|
24
|
+
|
25
|
+
resource :favorites,only:[:create,:destroy]
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
resources :users,only:[:show,:new,:index,:edit,:create,:update]
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
```
|
12
36
|
|
13
37
|
```
|
14
38
|
|
1
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -44,6 +44,20 @@
|
|
44
44
|
|
45
45
|
### 該当のソースコード
|
46
46
|
|
47
|
+
```
|
48
|
+
|
49
|
+
<% if @book.favorited_by?(current_user)%>
|
50
|
+
|
51
|
+
<%=link_to book.favorites.count,favorites_path(book), method: :delete class: "fas fa-heart heart_red" %>
|
52
|
+
|
53
|
+
<%else%>
|
54
|
+
|
55
|
+
<%= link_to book.favorites.count,favorites_path(book), method: :post class: "fas fa-heart heart_bule" %>
|
56
|
+
|
57
|
+
<%end%>
|
58
|
+
|
59
|
+
```
|
60
|
+
|
47
61
|
|
48
62
|
|
49
63
|
```showhtml
|