回答編集履歴

1

修正

2020/11/11 04:39

投稿

no1knows
no1knows

スコア3365

test CHANGED
@@ -9,3 +9,105 @@
9
9
  ```
10
10
 
11
11
  ログインしていないのではないでしょうか?
12
+
13
+
14
+
15
+ ---
16
+
17
+
18
+
19
+ Bootstrapのクラスの使い方が間違っていたため、期待通りの挙動をしていないだけでした。。。
20
+
21
+ ```erb
22
+
23
+ # application.html.erbのbody部分
24
+
25
+
26
+
27
+ <body>
28
+
29
+ <nav class="navbar navbar-expand-lg navbar-light bg-light">
30
+
31
+ <a class="navbar-brand" href="#">Bookers</a>
32
+
33
+ <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
34
+
35
+ <span class="navbar-toggler-icon"></span>
36
+
37
+ </button>
38
+
39
+
40
+
41
+ <div class="collapse navbar-collapse" id="navbarSupportedContent">
42
+
43
+ <ul class="navbar-nav mr-auto">
44
+
45
+ <% if user_signed_in? %>
46
+
47
+ <li class="nav-item">
48
+
49
+ <%= link_to "Home", user_path(current_user.id), class: "nav-link" %>
50
+
51
+ </li>
52
+
53
+ <li class="nav-item">
54
+
55
+ <%= link_to "Users", users_path, class: "nav-link" %>
56
+
57
+ </li>
58
+
59
+ <li class="nav-item">
60
+
61
+ <%= link_to "Books", books_path, class: "nav-link" %>
62
+
63
+ </li>
64
+
65
+ <li class="nav-item">
66
+
67
+ <%= link_to "logout", destroy_user_session_path, class: "nav-link", method: :delete %>
68
+
69
+ </li>
70
+
71
+ <% else %>
72
+
73
+ <li class="nav-item">
74
+
75
+ <%= link_to "Home", root_path, class: "nav-link" %>
76
+
77
+ </li>
78
+
79
+ <li class="nav-item">
80
+
81
+ <%= link_to "About", about_path, class: "nav-link" %>
82
+
83
+ </li>
84
+
85
+ <li class="nav-item">
86
+
87
+ <%= link_to "sign_up", new_user_registration_path, class: "nav-link" %>
88
+
89
+ </li>
90
+
91
+ <li class="nav-item">
92
+
93
+ <%= link_to "login", new_user_session_path, class: "nav-link" %>
94
+
95
+ </li>
96
+
97
+ <% end %>
98
+
99
+ </ul>
100
+
101
+ </div>
102
+
103
+ </nav>
104
+
105
+
106
+
107
+ <%= yield %>
108
+
109
+
110
+
111
+ </body>
112
+
113
+ ```