質問編集履歴

3

rooms index.html.erb を追加

2019/11/29 22:44

投稿

tagomaru025
tagomaru025

スコア6

test CHANGED
File without changes
test CHANGED
@@ -366,7 +366,43 @@
366
366
 
367
367
  ```
368
368
 
369
-
369
+ rooms index.html.erb ↓
370
+
371
+
372
+
373
+ ```<div class="container">
374
+
375
+ <h1><%= link_to "#{current_user.username}さんのページ", user_path(@user) %></h1>
376
+
377
+ <h3>Chatroom一覧</h3>
378
+
379
+ <div>
380
+
381
+ <ul>
382
+
383
+ <% @rooms.each do |room| %>
384
+
385
+ <li><%= link_to "ROOM#{room.id}", room_path(room.id, @user.id) %></li>
386
+
387
+ <% end %>
388
+
389
+ </ul>
390
+
391
+ </div>
392
+
393
+ <h3>お気に入り</h3>
394
+
395
+ <% if current_user.try(:admin?) %>
396
+
397
+ <%= link_to "管理者画面", admin_users_path, class: 'btn' %>
398
+
399
+ <% end %>
400
+
401
+ </div>
402
+
403
+ コード
404
+
405
+ ```
370
406
 
371
407
 
372
408
 

2

エラーコードの追加、各コードを<code>で括りました。

2019/11/29 22:44

投稿

tagomaru025
tagomaru025

スコア6

test CHANGED
File without changes
test CHANGED
@@ -78,7 +78,7 @@
78
78
 
79
79
 
80
80
 
81
- <code>
81
+
82
82
 
83
83
 
84
84
 
@@ -86,6 +86,12 @@
86
86
 
87
87
 
88
88
 
89
+
90
+
91
+ ```rooms_controller.rb ↓
92
+
93
+
94
+
89
95
  class RoomsController < ApplicationController
90
96
 
91
97
 
@@ -118,7 +124,15 @@
118
124
 
119
125
 
120
126
 
121
- <code>
127
+ コード
128
+
129
+ ```
130
+
131
+
132
+
133
+
134
+
135
+
122
136
 
123
137
 
124
138
 
@@ -126,7 +140,11 @@
126
140
 
127
141
 
128
142
 
143
+
144
+
145
+
146
+
129
- Rails.application.routes.draw do
147
+ ```Rails.application.routes.draw do
130
148
 
131
149
  namespace :admin do
132
150
 
@@ -166,15 +184,15 @@
166
184
 
167
185
  end
168
186
 
169
-
170
-
171
- </code>
172
-
173
-
174
-
175
-
176
-
177
- <code>
187
+ コード
188
+
189
+ ```
190
+
191
+
192
+
193
+
194
+
195
+
178
196
 
179
197
 
180
198
 
@@ -182,7 +200,7 @@
182
200
 
183
201
 
184
202
 
185
- class UsersController < ApplicationController
203
+ ```class UsersController < ApplicationController
186
204
 
187
205
  before_action :authenticate_user!
188
206
 
@@ -236,13 +254,11 @@
236
254
 
237
255
  end
238
256
 
239
-
240
-
241
- </code>
242
-
243
-
244
-
245
- <code>
257
+ コード
258
+
259
+ ```
260
+
261
+
246
262
 
247
263
 
248
264
 
@@ -250,7 +266,7 @@
250
266
 
251
267
 
252
268
 
253
- <div class="chat-room">
269
+ ```<div class="chat-room">
254
270
 
255
271
  <h1>Chat room</h1>
256
272
 
@@ -274,11 +290,9 @@
274
290
 
275
291
 
276
292
 
277
- </code>
278
-
279
-
280
-
281
- <code>
293
+ コード
294
+
295
+ ```
282
296
 
283
297
 
284
298
 
@@ -286,7 +300,7 @@
286
300
 
287
301
 
288
302
 
289
- <div class='message'>
303
+ ```<div class='message'>
290
304
 
291
305
  <% if @user.image.present? %>
292
306
 
@@ -302,13 +316,13 @@
302
316
 
303
317
  </div>
304
318
 
305
-
306
-
307
- </code>
308
-
309
-
310
-
311
- <code>
319
+ コード
320
+
321
+ ```
322
+
323
+
324
+
325
+
312
326
 
313
327
 
314
328
 
@@ -316,7 +330,7 @@
316
330
 
317
331
 
318
332
 
319
- create_table "users", force: :cascade do |t|
333
+ ```create_table "users", force: :cascade do |t|
320
334
 
321
335
  t.string "email", default: "", null: false
322
336
 
@@ -348,7 +362,11 @@
348
362
 
349
363
 
350
364
 
351
- </code>
365
+ コード
366
+
367
+ ```
368
+
369
+
352
370
 
353
371
 
354
372
 

1

エラーコードの追加、各コードを<code>で括りました。

2019/11/29 03:41

投稿

tagomaru025
tagomaru025

スコア6

test CHANGED
File without changes
test CHANGED
@@ -6,7 +6,67 @@
6
6
 
7
7
 
8
8
 
9
- ActionView::Template::Error (undefined method `image' for nil:NilClass):
9
+ Finished "/cable/" [WebSocket] for 192.168.33.1 at 2019-11-29 04:22:12 +0100
10
+
11
+ RoomChannel stopped streaming from room_channel_
12
+
13
+ Started GET "/cable" for 192.168.33.1 at 2019-11-29 04:22:12 +0100
14
+
15
+ Cannot render console from 192.168.33.1! Allowed networks: 127.0.0.0/127.255.255.255, ::1
16
+
17
+ Started GET "/cable/" [WebSocket] for 192.168.33.1 at 2019-11-29 04:22:12 +0100
18
+
19
+ Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
20
+
21
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ? [["id", 1], ["LIMIT", 1]]
22
+
23
+ ↳ app/channels/application_cable/connection.rb:12:in `find_verified_user'
24
+
25
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
26
+
27
+ ↳ app/channels/application_cable/connection.rb:12:in `find_verified_user'
28
+
29
+ Registered connection (Z2lkOi8vY2hhdGFwcC9Vc2VyLzE)
30
+
31
+ RoomChannel is transmitting the subscription confirmation
32
+
33
+ RoomChannel is streaming from room_channel_1
34
+
35
+ RoomChannel#speak({"message"=>"i have no idea"})
36
+
37
+ (0.1ms) begin transaction
38
+
39
+ ↳ app/channels/room_channel.rb:12:in `speak'
40
+
41
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
42
+
43
+ ↳ app/channels/room_channel.rb:12:in `speak'
44
+
45
+ Room Load (0.1ms) SELECT "rooms".* FROM "rooms" WHERE "rooms"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
46
+
47
+ ↳ app/channels/room_channel.rb:12:in `speak'
48
+
49
+ Message Create (2.8ms) INSERT INTO "messages" ("content", "created_at", "updated_at", "user_id", "room_id") VALUES (?, ?, ?, ?, ?) [["content", "i have no idea"], ["created_at", "2019-11-29 03:22:23.549954"], ["updated_at", "2019-11-29 03:22:23.549954"], ["user_id", 1], ["room_id", 1]]
50
+
51
+ ↳ app/channels/room_channel.rb:12:in `speak'
52
+
53
+ (7.4ms) commit transaction
54
+
55
+ ↳ app/channels/room_channel.rb:12:in `speak'
56
+
57
+ [ActiveJob] Enqueued MessageBroadcastJob (Job ID: 57f40449-6e0e-41c7-8dbc-efd67e142aac) to Async(default) with arguments: #<GlobalID:0x00007f2910d615b0 @uri=#<URI::GID gid://chatapp/Message/59>>
58
+
59
+ Message Load (0.2ms) SELECT "messages".* FROM "messages" WHERE "messages"."id" = ? LIMIT ? [["id", 59], ["LIMIT", 1]]
60
+
61
+ [ActiveJob] [MessageBroadcastJob] [57f40449-6e0e-41c7-8dbc-efd67e142aac] Performing MessageBroadcastJob (Job ID: 57f40449-6e0e-41c7-8dbc-efd67e142aac) from Async(default) enqueued at 2019-11-29T03:22:23Z with arguments: #<GlobalID:0x00007f2928034708 @uri=#<URI::GID gid://chatapp/Message/59>>
62
+
63
+ [ActiveJob] [MessageBroadcastJob] [57f40449-6e0e-41c7-8dbc-efd67e142aac] Rendered messages/_message.html.erb (Duration: 6.9ms | Allocations: 1487)
64
+
65
+ [ActiveJob] [MessageBroadcastJob] [57f40449-6e0e-41c7-8dbc-efd67e142aac] Error performing MessageBroadcastJob (Job ID: 57f40449-6e0e-41c7-8dbc-efd67e142aac) from Async(default) in 8.56ms: ActionView::Template::Error (undefined method `image' for nil:NilClass):
66
+
67
+ /home/vagrant/environment/chatapp/app/views/messages/_message.html.erb:2:in `_app_views_messages__message_html_erb__1902079675368871319_69907370882620'
68
+
69
+ /home/vagrant/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/actionview-6.0.1/lib/action_view/base.rb:274:in `_run'
10
70
 
11
71
 
12
72
 
@@ -18,6 +78,10 @@
18
78
 
19
79
 
20
80
 
81
+ <code>
82
+
83
+
84
+
21
85
  rooms_controller.rb ↓
22
86
 
23
87
 
@@ -50,6 +114,14 @@
50
114
 
51
115
 
52
116
 
117
+ </code>
118
+
119
+
120
+
121
+ <code>
122
+
123
+
124
+
53
125
  routes.rb ↓
54
126
 
55
127
 
@@ -66,9 +138,7 @@
66
138
 
67
139
  devise_for :users, :controllers => {
68
140
 
69
- registrations: 'users/registrations'
141
+ registrations: 'users/registrations'}
70
-
71
- }
72
142
 
73
143
 
74
144
 
@@ -98,6 +168,16 @@
98
168
 
99
169
 
100
170
 
171
+ </code>
172
+
173
+
174
+
175
+
176
+
177
+ <code>
178
+
179
+
180
+
101
181
  users_controller.rb ↓
102
182
 
103
183
 
@@ -158,6 +238,14 @@
158
238
 
159
239
 
160
240
 
241
+ </code>
242
+
243
+
244
+
245
+ <code>
246
+
247
+
248
+
161
249
  rooms show.html.erb ↓
162
250
 
163
251
 
@@ -186,6 +274,14 @@
186
274
 
187
275
 
188
276
 
277
+ </code>
278
+
279
+
280
+
281
+ <code>
282
+
283
+
284
+
189
285
  _messages.erb ↓
190
286
 
191
287
 
@@ -208,6 +304,14 @@
208
304
 
209
305
 
210
306
 
307
+ </code>
308
+
309
+
310
+
311
+ <code>
312
+
313
+
314
+
211
315
  schema.rb ↓
212
316
 
213
317
 
@@ -244,6 +348,10 @@
244
348
 
245
349
 
246
350
 
351
+ </code>
352
+
353
+
354
+
247
355
  schemaファイルにはimageカラムがあるのに何故エラーが出ているのでしょうか?
248
356
 
249
357