質問編集履歴

2

エラーコードなど編集しました。

2021/01/12 14:46

投稿

a-ichi
a-ichi

スコア16

test CHANGED
File without changes
test CHANGED
@@ -2,9 +2,13 @@
2
2
 
3
3
 
4
4
 
5
+ railsアプリで、
6
+
7
+ 以前は問題なく表示されていましたが、
8
+
5
- railsアプリでログインしていた時はアプリが表示されたのですが、
9
+ bootstrapの導入を試みたりDBの名前変更を試みたりしている間に
6
-
10
+
7
- ログウト後にアプリが表示されななりました。
11
+ アプリが全く表示されないようになりました。
8
12
 
9
13
  ローカル環境も本番環境も同じ状態です。
10
14
 
@@ -24,711 +28,737 @@
24
28
 
25
29
 
26
30
 
31
+ 真っ白になって、何も表示されません。
32
+
33
+
34
+
27
35
  ### 発生している問題・エラーメッセージ
28
36
 
29
37
 
30
38
 
31
- ミナ
39
+ 検証ツール
40
+
41
+
42
+
43
+ ```ここに言語を入力
44
+
45
+ preact.module.js:341 Uncaught TypeError: Cannot read property '__k' of null
46
+
47
+ at O (preact.module.js:341)
48
+
49
+ at DelayedRunner.Calendar._this.handleRenderRequest [as drainedOption] (main.js:48)
50
+
51
+ at DelayedRunner.drained (main.js:8619)
52
+
53
+ at DelayedRunner.tryDrain (main.js:8597)
54
+
55
+ at DelayedRunner.request (main.js:8546)
56
+
57
+ at Calendar.render (main.js:105)
58
+
59
+ at HTMLDocument.<anonymous> (calender.js:55)
60
+
61
+ at Object../node_modules/turbolinks/dist/turbolinks.js.e.dispatch (turbolinks.js:75)
62
+
63
+ at r.notifyApplicationAfterPageLoad (turbolinks.js:994)
64
+
65
+ at r.pageLoaded (turbolinks.js:948)
32
66
 
33
67
  ```
34
68
 
69
+
70
+
71
+ ### 該当のソースコード
72
+
35
- ActionView::Template::Error (undefined method `id' for nil:NilClass):
73
+ index.json.jbuilder
74
+
36
-
75
+ ```json
76
+
37
- 1: json.array!(@events) do |event|
77
+ json.array!(@events) do |event|
38
-
39
- 2: if current_user.id == event.user_id
78
+
40
-
41
- 3: json.extract! event, :id, :title, :body
79
+ json.extract! event, :id, :title, :body
42
-
80
+
43
- 4: json.start event.start_time
81
+ json.start event.start_time
44
-
82
+
45
- 5: json.end event.end_time
83
+ json.end event.end_time
84
+
85
+ json.url event_url(event, format: :html)
86
+
87
+ end
46
88
 
47
89
  ```
48
90
 
49
- ターミナル2
50
-
51
- ```ここに言語を入力
91
+ calender.js
92
+
52
-
93
+ ```js
94
+
95
+ import { Calendar } from '@fullcalendar/core';
96
+
97
+ import dayGridPlugin from '@fullcalendar/daygrid';
98
+
99
+ import interactionPlugin from '@fullcalendar/interaction';
100
+
53
- warning ../package.json: No license field
101
+ import listPlugin from '@fullcalendar/list';
102
+
54
-
103
+ import timeGridPlugin from '@fullcalendar/timegrid';
104
+
105
+
106
+
55
- [1/4] ???? Resolving packages...
107
+ document.addEventListener('turbolinks:load', function() {
56
-
108
+
109
+
110
+
57
- [2/4] ???? Fetching packages...
111
+ let calendarEl = document.getElementById('calendar');
58
-
112
+
59
- [3/4] ???? Linking dependencies...
113
+ let calendar = new Calendar(calendarEl, {
114
+
60
-
115
+ navLinks: true,
116
+
117
+ editable: true,
118
+
119
+ nowIndicator: true,
120
+
121
+ initialView: 'dayGridMonth',
122
+
123
+ displayEventTime: false,
124
+
125
+
126
+
127
+ locale: 'ja',
128
+
129
+ timeZone: 'Asia/Tokyo',
130
+
131
+ height: 600,
132
+
133
+ headerToolbar: {
134
+
61
- warning " > webpack-dev-server@3.11.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
135
+ left: "dayGridMonth,timeGridWeek,timeGridDay,listMonth",
136
+
62
-
137
+ center: "title",
138
+
139
+ right: "today prev,next"
140
+
141
+ },
142
+
143
+ buttonText: {
144
+
145
+ today: '今日',
146
+
147
+ month: '月',
148
+
149
+ list: 'リスト',
150
+
151
+ week: '週',
152
+
153
+ day: '日',
154
+
155
+ },
156
+
157
+ views: {
158
+
159
+ timeGridWeek: {
160
+
161
+ slotMinTime: '07:00:00',
162
+
163
+ slotMaxTime: '22:00:00'
164
+
165
+ },
166
+
167
+ timeGridDay: {
168
+
169
+ slotMinTime: '07:00:00',
170
+
171
+ slotMaxTime: '22:00:00'
172
+
173
+ }
174
+
175
+ },
176
+
177
+ eventClick: function(event) {
178
+
179
+ },
180
+
181
+ dayCellContent: function(e) {
182
+
183
+ e.dayNumberText = e.dayNumberText.replace('日', '');
184
+
185
+ },
186
+
187
+
188
+
189
+ eventSources: [{url:'/events.json',
190
+
191
+ color: '#2ECCFA'}
192
+
193
+ ],
194
+
63
- warning "webpack-dev-server > webpack-dev-middleware@3.7.3" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
195
+ plugins: [ dayGridPlugin, timeGridPlugin, interactionPlugin, listPlugin, ]
196
+
197
+ });
198
+
199
+
200
+
201
+
202
+
203
+ calendar.render();
204
+
205
+ });
206
+
207
+
64
208
 
65
209
  ```
66
210
 
67
- 検証ツール
68
-
69
-
70
-
71
- ```ここに言語を入力
72
-
73
- preact.module.js:341 Uncaught TypeError: Cannot read property '__k' of null
74
-
75
- at O (preact.module.js:341)
211
+ applicarion.js
76
-
77
- at DelayedRunner.Calendar._this.handleRenderRequest [as drainedOption] (main.js:48)
212
+
78
-
213
+
214
+
79
- at DelayedRunner.drained (main.js:8619)
215
+ ```js
80
-
81
- at DelayedRunner.tryDrain (main.js:8597)
216
+
82
-
83
- at DelayedRunner.request (main.js:8546)
217
+ require("@rails/ujs").start()
84
-
85
- at Calendar.render (main.js:105)
218
+
86
-
87
- at HTMLDocument.<anonymous> (calender.js:55)
88
-
89
- at Object../node_modules/turbolinks/dist/turbolinks.js.e.dispatch (turbolinks.js:75)
90
-
91
- at r.notifyApplicationAfterPageLoad (turbolinks.js:994)
92
-
93
- at r.pageLoaded (turbolinks.js:948)
219
+ require("turbolinks").start()
94
-
95
- O @ preact.module.js:341
220
+
96
-
97
- Calendar._this.handleRenderRequest @ main.js:48
221
+ require("@rails/activestorage").start()
98
-
99
- DelayedRunner.drained @ main.js:8619
222
+
100
-
101
- DelayedRunner.tryDrain @ main.js:8597
102
-
103
- DelayedRunner.request @ main.js:8546
223
+ require("channels")
104
-
105
- Calendar.render @ main.js:105
224
+
106
-
107
- (anonymous) @ calender.js:55
225
+ require("../calender.js")
108
-
109
- ./node_modules/turbolinks/dist/turbolinks.js.e.dispatch @ turbolinks.js:75
226
+
110
-
111
- r.notifyApplicationAfterPageLoad @ turbolinks.js:994
112
-
113
- r.pageLoaded @ turbolinks.js:948
227
+ require('jquery')
114
-
115
- (anonymous) @ turbolinks.js:872
228
+
116
-
117
- :3000/events.json?start=2020-12-27T00%3A00%3A00&end=2021-02-07T00%3A00%3A00&timeZone=Asia%2FTokyo:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
229
+
118
230
 
119
231
  ```
120
232
 
121
- 検証ツール2
122
-
123
- ```ここに言語を入力
124
-
125
- main.js:7930 Request failed
126
-
127
- Object
128
-
129
- (anonymous) @ main.js:7930
130
-
131
- load (async)
132
-
133
- requestJson @ main.js:8206
134
-
135
- fetch @ main.js:8274
136
-
137
- fetchSource @ main.js:7907
138
-
139
- fetchSourcesByIds @ main.js:7893
140
-
141
- fetchDirtySources @ main.js:7872
142
-
143
- addSources @ main.js:7859
144
-
145
- initEventSources @ main.js:7793
146
-
147
- CalendarDataManager @ main.js:8810
148
-
149
- Calendar @ main.js:78
150
-
151
- (anonymous) @ calender.js:10
152
-
153
- ./node_modules/turbolinks/dist/turbolinks.js.e.dispatch @ turbolinks.js:75
154
-
155
- r.notifyApplicationAfterPageLoad @ turbolinks.js:994
156
-
157
- r.pageLoaded @ turbolinks.js:948
158
-
159
- (anonymous)
233
+ event_controller.rb
234
+
235
+ ```ruby
236
+
237
+ class EventsController < ApplicationController
238
+
239
+ before_action :set_event, only: [:show, :edit, :update, :destroy]
240
+
241
+ before_action :move_to_index,except:[:index]
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+ def index
250
+
251
+ @events = Event.all
252
+
253
+ @customer = Customer.all
254
+
255
+ end
256
+
257
+
258
+
259
+ def new
260
+
261
+ @event = Event.new
262
+
263
+ end
264
+
265
+
266
+
267
+ def create
268
+
269
+ @event = Event.create(event_params)
270
+
271
+
272
+
273
+ if @event.save
274
+
275
+ redirect_to root_path, notice: "イベントを登録しました"
276
+
277
+ else
278
+
279
+ redirect_to new_event_path, notice: "登録出来ませんでした"
280
+
281
+ end
282
+
283
+ end
284
+
285
+
286
+
287
+ def destroy
288
+
289
+ if @event.destroy
290
+
291
+ redirect_to root_path, notice: 'イベントを削除しました'
292
+
293
+ else
294
+
295
+ flash.now[:alert] = 'イベントを削除できませんでした'
296
+
297
+ render :show
298
+
299
+ end
300
+
301
+ end
302
+
303
+
304
+
305
+ def edit
306
+
307
+ end
308
+
309
+
310
+
311
+ def update
312
+
313
+ if @event.update(event_params)
314
+
315
+ redirect_to root_path, notice: 'イベントを編集しました'
316
+
317
+ else
318
+
319
+ flash.now[:alert] = '必須事項を入力してください'
320
+
321
+ render :edit
322
+
323
+ end
324
+
325
+ end
326
+
327
+
328
+
329
+ def show
330
+
331
+ end
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+ private
340
+
341
+
342
+
343
+ def set_event
344
+
345
+ @event = Event.find(params[:id])
346
+
347
+ end
348
+
349
+
350
+
351
+ def event_params
352
+
353
+ params.require(:event).permit(:title, :body, :start_time, :end_time, :user, customer_ids:[]).merge(user_id: current_user.id)
354
+
355
+ end
356
+
357
+
358
+
359
+ def move_to_index
360
+
361
+ unless user_signed_in?
362
+
363
+ redirect_to action: :index
364
+
365
+ end
366
+
367
+ end
368
+
369
+
370
+
371
+ end
372
+
373
+
160
374
 
161
375
  ```
162
376
 
163
- ### 該当のソースコード
164
-
165
- index.json.jbuilder
166
-
167
- ```json
168
-
169
- json.array!(@events) do |event|
170
-
171
- if current_user.id == event.user_id
172
-
173
- json.extract! event, :id, :title, :body
174
-
175
- json.start event.start_time
176
-
177
- json.end event.end_time
178
-
179
- json.url event_url(event, format: :html)
180
-
181
- end
182
-
183
- end
377
+ webpacker.yml
378
+
379
+ ```yml
380
+
381
+ # Note: You must restart bin/webpack-dev-server for changes to take effect
382
+
383
+
384
+
385
+ default: &default
386
+
387
+ source_path: app/javascript
388
+
389
+ source_entry_path: packs
390
+
391
+ public_root_path: public
392
+
393
+ public_output_path: packs
394
+
395
+ cache_path: tmp/cache/webpacker
396
+
397
+ check_yarn_integrity: false
398
+
399
+ webpack_compile_output: true
400
+
401
+
402
+
403
+ # Additional paths webpack should lookup modules
404
+
405
+ # ['app/assets', 'engine/foo/app/assets']
406
+
407
+ resolved_paths: []
408
+
409
+
410
+
411
+ # Reload manifest.json on all requests so we reload latest compiled packs
412
+
413
+ cache_manifest: false
414
+
415
+
416
+
417
+ # Extract and emit a css file
418
+
419
+ extract_css: false
420
+
421
+
422
+
423
+ static_assets_extensions:
424
+
425
+ - .jpg
426
+
427
+ - .jpeg
428
+
429
+ - .png
430
+
431
+ - .gif
432
+
433
+ - .tiff
434
+
435
+ - .ico
436
+
437
+ - .svg
438
+
439
+ - .eot
440
+
441
+ - .otf
442
+
443
+ - .ttf
444
+
445
+ - .woff
446
+
447
+ - .woff2
448
+
449
+
450
+
451
+ extensions:
452
+
453
+ - .mjs
454
+
455
+ - .js
456
+
457
+ - .sass
458
+
459
+ - .scss
460
+
461
+ - .css
462
+
463
+ - .module.sass
464
+
465
+ - .module.scss
466
+
467
+ - .module.css
468
+
469
+ - .png
470
+
471
+ - .svg
472
+
473
+ - .gif
474
+
475
+ - .jpeg
476
+
477
+ - .jpg
478
+
479
+
480
+
481
+ development:
482
+
483
+ <<: *default
484
+
485
+ compile: true
486
+
487
+
488
+
489
+ # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
490
+
491
+ check_yarn_integrity: true
492
+
493
+
494
+
495
+ # Reference: https://webpack.js.org/configuration/dev-server/
496
+
497
+ dev_server:
498
+
499
+ https: true
500
+
501
+ host: localhost
502
+
503
+ port: 3035
504
+
505
+ public: localhost:3035
506
+
507
+ hmr: false
508
+
509
+ # Inline should be set to true if using HMR
510
+
511
+ inline: true
512
+
513
+ overlay: true
514
+
515
+ compress: true
516
+
517
+ disable_host_check: true
518
+
519
+ use_local_ip: false
520
+
521
+ quiet: false
522
+
523
+ pretty: false
524
+
525
+ headers:
526
+
527
+ 'Access-Control-Allow-Origin': '*'
528
+
529
+ watch_options:
530
+
531
+ ignored: '**/node_modules/**'
532
+
533
+
534
+
535
+
536
+
537
+ test:
538
+
539
+ <<: *default
540
+
541
+ compile: true
542
+
543
+
544
+
545
+ # Compile test packs to a separate directory
546
+
547
+ public_output_path: packs-test
548
+
549
+
550
+
551
+ production:
552
+
553
+ <<: *default
554
+
555
+
556
+
557
+ # Production depends on precompilation of packs prior to booting for performance.
558
+
559
+ compile: true
560
+
561
+
562
+
563
+ # Extract and emit a css file
564
+
565
+ extract_css: false
566
+
567
+
568
+
569
+ # Cache manifest.json for performance
570
+
571
+ cache_manifest: true
572
+
573
+
184
574
 
185
575
  ```
186
576
 
187
- calender.js
577
+ development.js
578
+
579
+
188
580
 
189
581
  ```js
190
582
 
191
- import { Calendar } from '@fullcalendar/core';
192
-
193
- import dayGridPlugin from '@fullcalendar/daygrid';
194
-
195
- import interactionPlugin from '@fullcalendar/interaction';
196
-
197
- import listPlugin from '@fullcalendar/list';
198
-
199
- import timeGridPlugin from '@fullcalendar/timegrid';
200
-
201
-
202
-
203
- document.addEventListener('turbolinks:load', function() {
204
-
205
-
206
-
207
- let calendarEl = document.getElementById('calendar');
583
+ process.env.NODE_ENV = process.env.NODE_ENV || 'development'
208
-
209
- let calendar = new Calendar(calendarEl, {
584
+
210
-
211
- navLinks: true,
585
+
212
-
213
- editable: true,
586
+
214
-
215
- nowIndicator: true,
216
-
217
- initialView: 'dayGridMonth',
218
-
219
- displayEventTime: false,
220
-
221
-
222
-
223
- locale: 'ja',
224
-
225
- timeZone: 'Asia/Tokyo',
226
-
227
- height: 600,
228
-
229
- headerToolbar: {
230
-
231
- left: "dayGridMonth,timeGridWeek,timeGridDay,listMonth",
232
-
233
- center: "title",
234
-
235
- right: "today prev,next"
236
-
237
- },
238
-
239
- buttonText: {
240
-
241
- today: '今日',
242
-
243
- month: '月',
244
-
245
- list: 'リスト',
246
-
247
- week: '週',
248
-
249
- day: '日',
250
-
251
- },
252
-
253
- views: {
254
-
255
- timeGridWeek: {
256
-
257
- slotMinTime: '07:00:00',
258
-
259
- slotMaxTime: '22:00:00'
260
-
261
- },
262
-
263
- timeGridDay: {
264
-
265
- slotMinTime: '07:00:00',
266
-
267
- slotMaxTime: '22:00:00'
268
-
269
- }
270
-
271
- },
272
-
273
- eventClick: function(event) {
274
-
275
- },
276
-
277
- dayCellContent: function(e) {
278
-
279
- e.dayNumberText = e.dayNumberText.replace('日', '');
280
-
281
- },
282
-
283
-
284
-
285
- eventSources: [{url:'/events.json',
587
+ const environment = require('./environment')
286
-
287
- color: '#2ECCFA'}
588
+
288
-
289
- ],
589
+
290
-
590
+
291
- plugins: [ dayGridPlugin, timeGridPlugin, interactionPlugin, listPlugin, ]
591
+ module.exports = environment.toWebpackConfig()
292
-
293
- });
294
-
295
-
296
-
297
-
298
-
299
- calendar.render();
300
-
301
- });
302
592
 
303
593
 
304
594
 
305
595
  ```
306
596
 
597
+
598
+
307
- applicarion.js
599
+ enviroment.js
308
600
 
309
601
 
310
602
 
311
603
  ```js
312
604
 
313
- require("@rails/ujs").start()
605
+ const { environment } = require('@rails/webpacker')
314
-
315
- require("turbolinks").start()
606
+
316
-
317
- require("@rails/activestorage").start()
607
+
318
-
608
+
319
- require("channels")
609
+ const webpack = require('webpack')
320
-
610
+
321
- require("../calender.js")
611
+ environment.plugins.prepend(
612
+
322
-
613
+ 'Provide',
614
+
615
+ new webpack.ProvidePlugin({
616
+
617
+ $: 'jquery',
618
+
323
- require('jquery')
619
+ jQuery: 'jquery',
620
+
621
+ Popper: 'popper.js'
622
+
623
+ })
624
+
625
+ )
626
+
627
+ module.exports = environment
324
628
 
325
629
 
326
630
 
327
631
  ```
328
632
 
329
- event_controller.rb
330
-
331
- ```ruby
332
-
333
- class EventsController < ApplicationController
334
-
335
- before_action :set_event, only: [:show, :edit, :update, :destroy]
336
-
337
- before_action :move_to_index,except:[:index]
338
-
339
-
340
-
341
-
342
-
343
-
344
-
345
- def index
346
-
347
- @events = Event.all
348
-
349
- @customer = Customer.all
350
-
351
- end
352
-
353
-
354
-
355
- def new
356
-
357
- @event = Event.new
358
-
359
- end
360
-
361
-
362
-
363
- def create
364
-
365
- @event = Event.create(event_params)
366
-
367
-
368
-
369
- if @event.save
370
-
371
- redirect_to root_path, notice: "イベントを登録しました"
372
-
373
- else
374
-
375
- redirect_to new_event_path, notice: "登録出来ませんでした"
376
-
377
- end
378
-
379
- end
380
-
381
-
382
-
383
- def destroy
384
-
385
- if @event.destroy
386
-
387
- redirect_to root_path, notice: 'イベントを削除しました'
388
-
389
- else
390
-
391
- flash.now[:alert] = 'イベントを削除できませんでした'
392
-
393
- render :show
394
-
395
- end
396
-
397
- end
398
-
399
-
400
-
401
- def edit
402
-
403
- end
404
-
405
-
406
-
407
- def update
408
-
409
- if @event.update(event_params)
410
-
411
- redirect_to root_path, notice: 'イベントを編集しました'
412
-
413
- else
414
-
415
- flash.now[:alert] = '必須事項を入力してください'
416
-
417
- render :edit
418
-
419
- end
420
-
421
- end
422
-
423
-
424
-
425
- def show
426
-
427
- end
428
-
429
-
430
-
431
-
432
-
433
-
434
-
435
- private
436
-
437
-
438
-
439
- def set_event
440
-
441
- @event = Event.find(params[:id])
442
-
443
- end
444
-
445
-
446
-
447
- def event_params
448
-
449
- params.require(:event).permit(:title, :body, :start_time, :end_time, :user, customer_ids:[]).merge(user_id: current_user.id)
450
-
451
- end
452
-
453
-
454
-
455
- def move_to_index
456
-
457
- unless user_signed_in?
458
-
459
- redirect_to action: :index
460
-
461
- end
462
-
463
- end
464
-
465
-
466
-
467
- end
468
-
469
-
633
+ index.html.haml
634
+
635
+ ```haml
636
+
637
+ .Customer-contents
638
+
639
+ -if user_signed_in?
640
+
641
+ .Side
642
+
643
+ .Side__header
644
+
645
+ 顧客一覧
646
+
647
+ .Side__body
648
+
649
+ .Side__body__customer
650
+
651
+ -@customer.each do |customer|
652
+
653
+ -if user_signed_in?
654
+
655
+ -if current_user.id == customer.user_id
656
+
657
+ .Customer-name
658
+
659
+ =link_to customer_path(customer.id),class: "Customer-name__btn" do
660
+
661
+ =customer.name
662
+
663
+ .Side__footer
664
+
665
+ =link_to(new_customer_path,class: "Side-btn") do
666
+
667
+
668
+
669
+ 顧客登録
670
+
671
+ .Main
672
+
673
+ .Main__header
674
+
675
+ .Main__header__contents
676
+
677
+ .Main__header__contents__left
678
+
679
+ CustomerCalender
680
+
681
+ .Main__header__contents__right
682
+
683
+ -if user_signed_in?
684
+
685
+ =link_to(destroy_user_session_path,method: :delete,class: "Right__login") do
686
+
687
+ ログアウト
688
+
689
+ - else
690
+
691
+ = link_to(users_guest_sign_in_path, method: :post,class: "Right__login" ) do
692
+
693
+ ゲストログイン(閲覧用)
694
+
695
+ =link_to(new_user_session_path,class: "Right__login") do
696
+
697
+ ログイン
698
+
699
+ =link_to(new_user_registration_path,class: "Right__new") do
700
+
701
+ 新規登録
702
+
703
+ .Main__body
704
+
705
+ -if user_signed_in?
706
+
707
+ %p#calendar
708
+
709
+ .Main__footer
710
+
711
+ .Main__footer__content
712
+
713
+ -if user_signed_in?
714
+
715
+ =link_to(new_event_path,class: "Footer-btn") do
716
+
717
+
718
+
719
+ スケジュール入力
720
+
721
+
722
+
723
+
724
+
725
+
726
+
727
+ -if user_signed_in?
728
+
729
+ .Side-hiden
730
+
731
+ .Side-hiden__header
732
+
733
+ 顧客一覧
734
+
735
+ .Side-hiden__body
736
+
737
+ .Side-hiden__body__customer
738
+
739
+ -@customer.each do |customer|
740
+
741
+ -if user_signed_in?
742
+
743
+ -if current_user.id == customer.user_id
744
+
745
+ .Customer-name
746
+
747
+ =link_to customer_path(customer.id),class: "Customer-name__btn" do
748
+
749
+ =customer.name
750
+
751
+ .Side-hiden__footer
752
+
753
+ =link_to(new_customer_path,class: "Side-btn") do
754
+
755
+
756
+
757
+ 顧客登録
470
758
 
471
759
  ```
472
760
 
473
- webpacker.yml
761
+
474
-
475
- ```yml
476
-
477
- # Note: You must restart bin/webpack-dev-server for changes to take effect
478
-
479
-
480
-
481
- default: &default
482
-
483
- source_path: app/javascript
484
-
485
- source_entry_path: packs
486
-
487
- public_root_path: public
488
-
489
- public_output_path: packs
490
-
491
- cache_path: tmp/cache/webpacker
492
-
493
- check_yarn_integrity: false
494
-
495
- webpack_compile_output: true
496
-
497
-
498
-
499
- # Additional paths webpack should lookup modules
500
-
501
- # ['app/assets', 'engine/foo/app/assets']
502
-
503
- resolved_paths: []
504
-
505
-
506
-
507
- # Reload manifest.json on all requests so we reload latest compiled packs
508
-
509
- cache_manifest: false
510
-
511
-
512
-
513
- # Extract and emit a css file
514
-
515
- extract_css: false
516
-
517
-
518
-
519
- static_assets_extensions:
520
-
521
- - .jpg
522
-
523
- - .jpeg
524
-
525
- - .png
526
-
527
- - .gif
528
-
529
- - .tiff
530
-
531
- - .ico
532
-
533
- - .svg
534
-
535
- - .eot
536
-
537
- - .otf
538
-
539
- - .ttf
540
-
541
- - .woff
542
-
543
- - .woff2
544
-
545
-
546
-
547
- extensions:
548
-
549
- - .mjs
550
-
551
- - .js
552
-
553
- - .sass
554
-
555
- - .scss
556
-
557
- - .css
558
-
559
- - .module.sass
560
-
561
- - .module.scss
562
-
563
- - .module.css
564
-
565
- - .png
566
-
567
- - .svg
568
-
569
- - .gif
570
-
571
- - .jpeg
572
-
573
- - .jpg
574
-
575
-
576
-
577
- development:
578
-
579
- <<: *default
580
-
581
- compile: true
582
-
583
-
584
-
585
- # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
586
-
587
- check_yarn_integrity: true
588
-
589
-
590
-
591
- # Reference: https://webpack.js.org/configuration/dev-server/
592
-
593
- dev_server:
594
-
595
- https: true
596
-
597
- host: localhost
598
-
599
- port: 3035
600
-
601
- public: localhost:3035
602
-
603
- hmr: false
604
-
605
- # Inline should be set to true if using HMR
606
-
607
- inline: true
608
-
609
- overlay: true
610
-
611
- compress: true
612
-
613
- disable_host_check: true
614
-
615
- use_local_ip: false
616
-
617
- quiet: false
618
-
619
- pretty: false
620
-
621
- headers:
622
-
623
- 'Access-Control-Allow-Origin': '*'
624
-
625
- watch_options:
626
-
627
- ignored: '**/node_modules/**'
628
-
629
-
630
-
631
-
632
-
633
- test:
634
-
635
- <<: *default
636
-
637
- compile: true
638
-
639
-
640
-
641
- # Compile test packs to a separate directory
642
-
643
- public_output_path: packs-test
644
-
645
-
646
-
647
- production:
648
-
649
- <<: *default
650
-
651
-
652
-
653
- # Production depends on precompilation of packs prior to booting for performance.
654
-
655
- compile: true
656
-
657
-
658
-
659
- # Extract and emit a css file
660
-
661
- extract_css: false
662
-
663
-
664
-
665
- # Cache manifest.json for performance
666
-
667
- cache_manifest: true
668
-
669
-
670
-
671
- ```
672
-
673
- development.js
674
-
675
-
676
-
677
- ```js
678
-
679
- process.env.NODE_ENV = process.env.NODE_ENV || 'development'
680
-
681
-
682
-
683
- const environment = require('./environment')
684
-
685
-
686
-
687
- module.exports = environment.toWebpackConfig()
688
-
689
-
690
-
691
- ```
692
-
693
-
694
-
695
- enviroment.js
696
-
697
-
698
-
699
- ```js
700
-
701
- const { environment } = require('@rails/webpacker')
702
-
703
-
704
-
705
- const webpack = require('webpack')
706
-
707
- environment.plugins.prepend(
708
-
709
- 'Provide',
710
-
711
- new webpack.ProvidePlugin({
712
-
713
- $: 'jquery',
714
-
715
- jQuery: 'jquery',
716
-
717
- Popper: 'popper.js'
718
-
719
- })
720
-
721
- )
722
-
723
-
724
-
725
-
726
-
727
- module.exports = environment
728
-
729
-
730
-
731
- ```
732
762
 
733
763
  ### 試したこと
734
764
 
@@ -748,30 +778,6 @@
748
778
 
749
779
 
750
780
 
751
- ・index.json.jbuilderを
752
-
753
- ```ここに言語を入力
754
-
755
- json.array!(@events) do |event|
756
-
757
- json.extract! event, :id, :title, :body
758
-
759
- json.start event.start_time
760
-
761
- json.end event.end_time
762
-
763
- json.url event_url(event, format: :html)
764
-
765
- end
766
-
767
- ```
768
-
769
- このように変更し、if文を削除してみると、
770
-
771
- ActionView::Template::Error (undefined method `id' for nil:NilClass):
772
-
773
- このエラーは出なくなりましたが、表示はされませんでした。
774
-
775
781
 
776
782
 
777
783
  ### 補足情報(FW/ツールのバージョンなど)

1

試した事追加

2021/01/12 14:46

投稿

a-ichi
a-ichi

スコア16

test CHANGED
File without changes
test CHANGED
@@ -748,7 +748,29 @@
748
748
 
749
749
 
750
750
 
751
-
751
+ ・index.json.jbuilderを
752
+
753
+ ```ここに言語を入力
754
+
755
+ json.array!(@events) do |event|
756
+
757
+ json.extract! event, :id, :title, :body
758
+
759
+ json.start event.start_time
760
+
761
+ json.end event.end_time
762
+
763
+ json.url event_url(event, format: :html)
764
+
765
+ end
766
+
767
+ ```
768
+
769
+ このように変更し、if文を削除してみると、
770
+
771
+ ActionView::Template::Error (undefined method `id' for nil:NilClass):
772
+
773
+ このエラーは出なくなりましたが、表示はされませんでした。
752
774
 
753
775
 
754
776