質問編集履歴

12

コード修正

2019/06/27 00:41

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -52,7 +52,7 @@
52
52
 
53
53
  def login_form
54
54
 
55
- return redirect_to photographer_schedule_path(session[:p_id]) if session[:p_id]
55
+ return redirect_to schedule_photographer_distribution_path(session[:p_id]) if session[:p_id]
56
56
 
57
57
  end
58
58
 

11

見た目の修正

2019/06/27 00:41

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -228,7 +228,7 @@
228
228
 
229
229
 
230
230
 
231
-
231
+ ```
232
232
 
233
233
  I, [2019-06-21T14:15:36.562217 #61286] INFO -- : Started POST "/photographer_login" for 127.0.0.1 at 2019-06-21 14:15:36 +0900
234
234
 
@@ -268,7 +268,7 @@
268
268
 
269
269
  I, [2019-06-21T14:15:37.026764 #61286] INFO -- : Started POST "/__better_errors/d07df247e6337ae9/variables" for 127.0.0.1 at 2019-06-21 14:15:37 +0900
270
270
 
271
-
271
+ ```
272
272
 
273
273
 
274
274
 
@@ -310,6 +310,8 @@
310
310
 
311
311
 
312
312
 
313
+ ```
314
+
313
315
  D, [2019-06-21T14:19:45.543022 #61286] DEBUG -- :
314
316
 
315
317
  D, [2019-06-21T14:19:45.544650 #61286] DEBUG -- :
@@ -344,9 +346,7 @@
344
346
 
345
347
  I, [2019-06-21T14:19:52.843714 #61286] INFO -- : Completed 200 OK in 298ms (Views: 163.1ms | ActiveRecord: 27.2ms)
346
348
 
347
-
349
+ ```
348
-
349
-
350
350
 
351
351
 
352
352
 

10

コード修正

2019/06/21 06:51

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -356,13 +356,7 @@
356
356
 
357
357
  ログインしてビューにリダイレクトした際、
358
358
 
359
- 1. check_user_agent_for_mobileメソッドが呼ばれないためschedule.html+mobile.erbではなくschedule.html.erbが呼ばれる
360
-
361
- 2. class Photographer::ApplicationControllerのcurrent_photographerメソッドが呼ばれない
359
+ class Photographer::ApplicationControllerのcurrent_photographerメソッドが呼ばれません。
362
-
363
-
364
-
365
- といった問題が起こっています。
366
360
 
367
361
 
368
362
 
@@ -374,9 +368,7 @@
374
368
 
375
369
 
376
370
 
377
- 1. ログインした際にschedule.html+mobile.erbに飛ぶようにしたい
378
-
379
- 2. class Photographer::ApplicationControllerのcurrent_photographerメソッドが呼ばれるようにしたい
371
+ ログインした際にclass Photographer::ApplicationControllerのcurrent_photographerメソッドが呼ばれるようにしたいです。
380
372
 
381
373
 
382
374
 

9

コード修正

2019/06/21 05:33

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -1,4 +1,4 @@
1
- 管理画面のログイン機能を実装していますが、挙動がおかしいです
1
+ 管理画面のログイン機能を実装しています。
2
2
 
3
3
 
4
4
 
@@ -6,9 +6,9 @@
6
6
 
7
7
  1. PhotographersControllerでsession[:p_id]を取得し、ログインしてphotographer/distribution_controller.rbのscheduleメソッドに飛ばします。
8
8
 
9
- 2. Photographer::DistributionsControllerはPhotographer::ApplicationControllerを受け継いでいて、Photographer::ApplicationController内にcheck_user_agent_for_mobileメソッドを記述しています。
9
+ 2. Photographer::DistributionsControllerはPhotographer::ApplicationControllerを受け継いでいて、Photographer::ApplicationController内にcurrent_photographerメソッドを記述しています。
10
-
10
+
11
- 3. check_user_agent_for_mobileメソッドをPhotographer::DistributionsController内でbefore_actionで記述しています。
11
+ 3. current_photographerメソッドをPhotographer::DistributionsController内でbefore_actionで記述しています。
12
12
 
13
13
 
14
14
 
@@ -214,70 +214,6 @@
214
214
 
215
215
  end
216
216
 
217
-
218
-
219
- def show
220
-
221
- @dist = PhotographersDistribution.find(params[:id])
222
-
223
- end
224
-
225
-
226
-
227
- def schedule
228
-
229
- @current_photographer = Photographer.find(session[:p_id])
230
-
231
- @dists = PhotographersDistribution.where(photographer_id: @current_photographer.id).order(created_at: :desc)
232
-
233
- @total_fee = @dists.map{|x| x.payment_fee}.sum
234
-
235
- end
236
-
237
-
238
-
239
- def decide
240
-
241
- dist = PhotographersDistribution.find(params[:id])
242
-
243
-
244
-
245
- if dist.update(photographer_id: @current_photographer.id, display_flg: false)
246
-
247
- redirect_to photographer_distributions_path
248
-
249
- else
250
-
251
- redirect_to photographer_distributions_path
252
-
253
- end
254
-
255
- end
256
-
257
-
258
-
259
- def cancel
260
-
261
- dist = PhotographersDistribution.find(params[:id])
262
-
263
- dist.update(
264
-
265
- photographer_id: nil,
266
-
267
- display_flg: true
268
-
269
- )
270
-
271
- respond_to do |format|
272
-
273
- format.html { redirect_to photographer_schedule_url }
274
-
275
- format.json { head :no_content }
276
-
277
- end
278
-
279
- end
280
-
281
217
  end
282
218
 
283
219
 
@@ -292,71 +228,121 @@
292
228
 
293
229
 
294
230
 
295
- > D, [2019-06-14T09:04:44.077894 #29691] DEBUG -- :
296
-
297
- D, [2019-06-14T09:04:44.079034 #29691] DEBUG -- :
298
-
299
- I, [2019-06-14T09:04:44.079369 #29691] INFO -- : Started GET "/photographer_login" for 127.0.0.1 at 2019-06-14 09:04:44 +0900
300
-
301
- I, [2019-06-14T09:04:44.110022 #29691] INFO -- : Processing by PhotographersController#login_form as HTML
302
-
303
- I, [2019-06-14T09:04:44.119104 #29691] INFO -- : Redirected to http://localhost:3000/photographer/distributions/2/schedule
304
-
305
- I, [2019-06-14T09:04:44.119627 #29691] INFO -- : Completed 302 Found in 9ms (ActiveRecord: 2.3ms)
306
-
307
- D, [2019-06-14T09:04:44.124753 #29691] DEBUG -- :
308
-
309
- D, [2019-06-14T09:04:44.125013 #29691] DEBUG -- :
310
-
311
- I, [2019-06-14T09:04:44.125309 #29691] INFO -- : Started GET "/photographer/distributions/2/schedule" for 127.0.0.1 at 2019-06-14 09:04:44 +0900
312
-
313
- I, [2019-06-14T09:04:44.152587 #29691] INFO -- : Processing by Photographer::DistributionsController#schedule as HTML
314
-
315
- I, [2019-06-14T09:04:44.152722 #29691] INFO -- : Parameters: {"id"=>"2"}
316
-
317
- I, [2019-06-14T09:04:44.162881 #29691] INFO -- : Completed 500 Internal Server Error in 10ms (ActiveRecord: 1.9ms)
318
-
319
- F, [2019-06-14T09:04:44.173953 #29691] FATAL -- :
320
-
321
- NoMethodError - undefined method `id' for nil:NilClass:
322
-
323
- app/controllers/photographer/distributions_controller.rb:45:in `schedule'
324
-
325
- D, [2019-06-14T09:04:44.431073 #29691] DEBUG -- :
326
-
327
- D, [2019-06-14T09:04:44.431388 #29691] DEBUG -- :
328
-
329
- I, [2019-06-14T09:04:44.431637 #29691] INFO -- : Started POST "/__better_errors/4f85b10ab02519c8/variables" for 127.0.0.1 at 2019-06-14 09:04:44 +0900
330
-
331
-
332
-
333
- check_user_agent_for_mobileとcurrent_photographerメソッドが呼ばれる場合のログ(class PhotographersController内のコードにスペースを入れたりすると、呼ばれる)
334
-
335
-
336
-
337
- > D, [2019-06-14T09:17:24.282129 #29691] DEBUG -- :
338
-
339
- D, [2019-06-14T09:17:24.284610 #29691] DEBUG -- :
340
-
341
- I, [2019-06-14T09:17:24.288359 #29691] INFO -- : Started GET "/photographer/distributions/2/schedule" for 127.0.0.1 at 2019-06-14 09:17:24 +0900
342
-
343
- I, [2019-06-14T09:17:26.561787 #29691] INFO -- : Processing by Photographer::DistributionsController#schedule as HTML
344
-
345
- I, [2019-06-14T09:17:26.562443 #29691] INFO -- : Parameters: {"id"=>"2"}
346
-
347
- D, [2019-06-14T09:17:26.648209 #29691] DEBUG -- : Photographer Load (0.7ms) SELECT `photographers`.* FROM `photographers` WHERE `photographers`.`id` = 2 LIMIT 1
348
-
349
- D, [2019-06-14T09:17:26.669742 #29691] DEBUG -- : PhotographersDistribution Load (0.5ms) SELECT `photographers_distributions`.* FROM `photographers_distributions` WHERE `photographers_distributions`.`photographer_id` = 2 AND `photographers_distributions`.`status_id` = 3 AND (`photographers_distributions`.`selected_at` BETWEEN '2019-06-14 00:00:00' AND '2019-06-14 23:59:59') ORDER BY `photographers_distributions`.`selected_at` DESC
350
-
351
- D, [2019-06-14T09:17:26.675389 #29691] DEBUG -- : (1.3ms) SELECT COUNT(*) AS count_all, DATE(created_at) AS date_created_at FROM `photographers_distributions` WHERE `photographers_distributions`.`photographer_id` = 2 AND `photographers_distributions`.`status_id` = 3 AND (`photographers_distributions`.`selected_at` BETWEEN '2019-06-14 00:00:00' AND '2019-06-14 23:59:59') GROUP BY DATE(created_at) ORDER BY `photographers_distributions`.`selected_at` DESC
352
-
353
- D, [2019-06-14T09:17:26.676793 #29691] DEBUG -- : (0.4ms) SELECT COUNT(*) FROM `photographers_distributions` WHERE `photographers_distributions`.`photographer_id` = 2 AND `photographers_distributions`.`status_id` = 3 AND (`photographers_distributions`.`selected_at` BETWEEN '2019-06-14 00:00:00' AND '2019-06-14 23:59:59') AND `photographers_distributions`.`over_transit_time_flg` = 1
354
-
355
- D, [2019-06-14T09:17:26.698022 #29691] DEBUG -- : (0.5ms) SELECT COUNT(*) FROM `photographers_distributions` WHERE `photographers_distributions`.`photographer_id` = 2 AND `photographers_distributions`.`status_id` = 3 AND (`photographers_distributions`.`selected_at` BETWEEN '2019-06-14 00:00:00' AND '2019-06-14 23:59:59')
356
-
357
- I, [2019-06-14T09:17:26.716581 #29691] INFO -- : Rendered photographer/distributions/schedule.html+mobile.erb within layouts/photographers_distribution (24.0ms)
358
-
359
- I, [2019-06-14T09:17:27.008918 #29691] INFO -- : Completed 200 OK in 446ms (Views: 331.1ms | ActiveRecord: 39.9ms)
231
+
232
+
233
+ I, [2019-06-21T14:15:36.562217 #61286] INFO -- : Started POST "/photographer_login" for 127.0.0.1 at 2019-06-21 14:15:36 +0900
234
+
235
+ I, [2019-06-21T14:15:36.580546 #61286] INFO -- : Processing by PhotographersController#login as HTML
236
+
237
+ I, [2019-06-21T14:15:36.580672 #61286] INFO -- : Parameters: {"utf8"=>"✓", "authenticity_token"=>"XEHv55kFs+XFYq5I3ZH+xE/6CSJLSd2PNK/UTOeP+C3EF0j4VIFZ4Ii4eXMQDihLZQ+Z6P3rOY94lp+8TBzJDA==", "email"=>"admin@example.com", "password"=>"[FILTERED]"}
238
+
239
+ D, [2019-06-21T14:15:36.593618 #61286] DEBUG -- : Photographer Load (3.1ms) SELECT `photographers`.* FROM `photographers` WHERE `photographers`.`email` = 'admin@example.com' LIMIT 1
240
+
241
+ I, [2019-06-21T14:15:36.658521 #61286] INFO -- : Redirected to http://localhost:3000/photographer/distributions
242
+
243
+ I, [2019-06-21T14:15:36.658770 #61286] INFO -- : Completed 302 Found in 78ms (ActiveRecord: 8.6ms
244
+
245
+ I, [2019-06-21T14:15:36.664076 #61286] INFO -- : Started GET "/photographer/distributions" for 127.0.0.1 at 2019-06-21 14:15:36 +0900
246
+
247
+ /Users/livesearch/Desktop/job/contents-store/app/controllers/photographer/distributions_controller.rb:1: warning: toplevel constant ApplicationController referenced by Photographer::ApplicationController
248
+
249
+ I, [2019-06-21T14:15:36.691243 #61286] INFO -- : Processing by Photographer::DistributionsController#index as HTML
250
+
251
+ D, [2019-06-21T14:15:36.709322 #61286] DEBUG -- : PhotographersDistribution Load (2.8ms) SELECT `photographers_distributions`.* FROM `photographers_distributions` WHERE `photographers_distributions`.`status_id` = 2 ORDER BY `photographers_distributions`.`id` DESC
252
+
253
+ D, [2019-06-21T14:15:36.757196 #61286] DEBUG -- : Request Load (3.7ms) SELECT `requests`.* FROM `requests` WHERE `requests`.`id` = 121 LIMIT 1
254
+
255
+ I, [2019-06-21T14:15:36.839963 #61286] INFO -- : Completed 500 Internal Server Error in 148ms (ActiveRecord: 17.8ms)
256
+
257
+ F, [2019-06-21T14:15:36.847954 #61286] FATAL -- :
258
+
259
+ NoMethodError - undefined method `latitude' for nil:NilClass:
260
+
261
+ app/views/photographer/distributions/index.html+mobile.erb:31:in `_app_views_photographer_distributions_index_html_mobile_erb__30980350848312437_70305103253380'
262
+
263
+
264
+
265
+ D, [2019-06-21T14:15:37.026341 #61286] DEBUG -- :
266
+
267
+ D, [2019-06-21T14:15:37.026457 #61286] DEBUG -- :
268
+
269
+ I, [2019-06-21T14:15:37.026764 #61286] INFO -- : Started POST "/__better_errors/d07df247e6337ae9/variables" for 127.0.0.1 at 2019-06-21 14:15:37 +0900
270
+
271
+
272
+
273
+
274
+
275
+ photographers/distributions/index.html+mobile.erb
276
+
277
+ ```ruby
278
+
279
+ <script type="text/javascript">
280
+
281
+ function allMap() {
282
+
283
+ handler = Gmaps.build('Google');
284
+
285
+ handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){
286
+
287
+ markers = handler.addMarkers(<%=raw @hash.to_json %>);
288
+
289
+ handler.bounds.extendWith(markers);
290
+
291
+ handler.fitMapToBounds();
292
+
293
+ handler.getMap().setZoom(12);
294
+
295
+ google.maps.event.trigger(map,'resize');
296
+
297
+ handler.map.centerOn([<%= @current_photographer.latitude %>,<%= @current_photographer.longitude %>]); ⬅この行で@current_photographerがnilだと言われる。 //
298
+
299
+ });
300
+
301
+ }
302
+
303
+ </script>
304
+
305
+ ```
306
+
307
+
308
+
309
+ current_photographerメソッドが呼ばれる場合のログ(class PhotographersController内のコードにスペースを入れたりすると、呼ばれる)
310
+
311
+
312
+
313
+ D, [2019-06-21T14:19:45.543022 #61286] DEBUG -- :
314
+
315
+ D, [2019-06-21T14:19:45.544650 #61286] DEBUG -- :
316
+
317
+ I, [2019-06-21T14:19:45.545663 #61286] INFO -- : Started POST "/__better_errors/c1bb543e52e1faf2/variables" for 127.0.0.1 at 2019-06-21 14:19:45 +0900
318
+
319
+ D, [2019-06-21T14:19:51.656377 #61286] DEBUG -- :
320
+
321
+ D, [2019-06-21T14:19:51.656729 #61286] DEBUG -- :
322
+
323
+ I, [2019-06-21T14:19:51.656884 #61286] INFO -- : Started GET "/photographer/distributions" for 127.0.0.1 at 2019-06-21 14:19:51 +0900
324
+
325
+ I, [2019-06-21T14:19:52.545131 #61286] INFO -- : Processing by Photographer::DistributionsController#index as HTML
326
+
327
+ D, [2019-06-21T14:19:52.589319 #61286] DEBUG -- : Photographer Load (0.9ms) SELECT `photographers`.* FROM `photographers` WHERE `photographers`.`id` = 1 LIMIT 1
328
+
329
+ D, [2019-06-21T14:19:52.608170 #61286] DEBUG -- : PhotographersDistribution Load (0.3ms) SELECT `photographers_distributions`.* FROM `photographers_distributions` WHERE `photographers_distributions`.`status_id` = 2 ORDER BY `photographers_distributions`.`id` DESC
330
+
331
+ D, [2019-06-21T14:19:52.636882 #61286] DEBUG -- : Request Load (1.1ms) SELECT `requests`.* FROM `requests` WHERE `requests`.`id` = 121 LIMIT 1
332
+
333
+ I, [2019-06-21T14:19:52.665693 #61286] INFO -- : Rendered layouts/_infowindow_photographer.html.erb (0.6ms)
334
+
335
+ D, [2019-06-21T14:19:52.666663 #61286] DEBUG -- : Request Load (0.3ms) SELECT `requests`.* FROM `requests` WHERE `requests`.`id` = 119 LIMIT 1
336
+
337
+ I, [2019-06-21T14:19:52.673087 #61286] INFO -- : Rendered layouts/_infowindow_photographer.html.erb (0.5ms)
338
+
339
+ D, [2019-06-21T14:19:52.675698 #61286] DEBUG -- : Request Load (0.7ms) SELECT `requests`.* FROM `requests` WHERE `requests`.`id` = 135 LIMIT 1
340
+
341
+ I, [2019-06-21T14:19:52.680291 #61286] INFO -- : Rendered layouts/_infowindow_photographer.html.erb (0.4ms)
342
+
343
+ I, [2019-06-21T14:19:52.691623 #61286] INFO -- : Rendered photographer/distributions/index.html+mobile.erb within layouts/photographers_distribution (1.3ms)
344
+
345
+ I, [2019-06-21T14:19:52.843714 #61286] INFO -- : Completed 200 OK in 298ms (Views: 163.1ms | ActiveRecord: 27.2ms)
360
346
 
361
347
 
362
348
 

8

コード修正

2019/06/21 05:30

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -72,7 +72,7 @@
72
72
 
73
73
  flash[:notice] = "ログインしました"
74
74
 
75
- return redirect_to (forwarding_url || photographer_schedule_url(session[:p_id]))
75
+ return redirect_to (forwarding_url || photographer_distributions_url)
76
76
 
77
77
  else
78
78
 

7

コード修正

2019/06/21 03:16

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -134,7 +134,7 @@
134
134
 
135
135
  end
136
136
 
137
- @current_photographer = Photographer.find_by(id: session[:p_id])
137
+ @current_photographer = Photographer.find(session[:p_id])
138
138
 
139
139
  end
140
140
 

6

文の整形

2019/06/21 01:34

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -322,8 +322,6 @@
322
322
 
323
323
  app/controllers/photographer/distributions_controller.rb:45:in `schedule'
324
324
 
325
-
326
-
327
325
  D, [2019-06-14T09:04:44.431073 #29691] DEBUG -- :
328
326
 
329
327
  D, [2019-06-14T09:04:44.431388 #29691] DEBUG -- :

5

ログ詳細を追記

2019/06/14 00:20

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -286,9 +286,99 @@
286
286
 
287
287
 
288
288
 
289
- ###実現したいこと
290
-
291
- ログインしてビューにリダイレクトした際、check_user_agent_for_mobileメソッドが呼ばれず、schedule.html+mobile.erbではなくschedule.html.erbが呼ばれます。
289
+ ###ログ
290
+
291
+ check_user_agent_for_mobileメソッドcurrent_photographerメソッドが呼ばれない場合のログ
292
+
293
+
294
+
295
+ > D, [2019-06-14T09:04:44.077894 #29691] DEBUG -- :
296
+
297
+ D, [2019-06-14T09:04:44.079034 #29691] DEBUG -- :
298
+
299
+ I, [2019-06-14T09:04:44.079369 #29691] INFO -- : Started GET "/photographer_login" for 127.0.0.1 at 2019-06-14 09:04:44 +0900
300
+
301
+ I, [2019-06-14T09:04:44.110022 #29691] INFO -- : Processing by PhotographersController#login_form as HTML
302
+
303
+ I, [2019-06-14T09:04:44.119104 #29691] INFO -- : Redirected to http://localhost:3000/photographer/distributions/2/schedule
304
+
305
+ I, [2019-06-14T09:04:44.119627 #29691] INFO -- : Completed 302 Found in 9ms (ActiveRecord: 2.3ms)
306
+
307
+ D, [2019-06-14T09:04:44.124753 #29691] DEBUG -- :
308
+
309
+ D, [2019-06-14T09:04:44.125013 #29691] DEBUG -- :
310
+
311
+ I, [2019-06-14T09:04:44.125309 #29691] INFO -- : Started GET "/photographer/distributions/2/schedule" for 127.0.0.1 at 2019-06-14 09:04:44 +0900
312
+
313
+ I, [2019-06-14T09:04:44.152587 #29691] INFO -- : Processing by Photographer::DistributionsController#schedule as HTML
314
+
315
+ I, [2019-06-14T09:04:44.152722 #29691] INFO -- : Parameters: {"id"=>"2"}
316
+
317
+ I, [2019-06-14T09:04:44.162881 #29691] INFO -- : Completed 500 Internal Server Error in 10ms (ActiveRecord: 1.9ms)
318
+
319
+ F, [2019-06-14T09:04:44.173953 #29691] FATAL -- :
320
+
321
+ NoMethodError - undefined method `id' for nil:NilClass:
322
+
323
+ app/controllers/photographer/distributions_controller.rb:45:in `schedule'
324
+
325
+
326
+
327
+ D, [2019-06-14T09:04:44.431073 #29691] DEBUG -- :
328
+
329
+ D, [2019-06-14T09:04:44.431388 #29691] DEBUG -- :
330
+
331
+ I, [2019-06-14T09:04:44.431637 #29691] INFO -- : Started POST "/__better_errors/4f85b10ab02519c8/variables" for 127.0.0.1 at 2019-06-14 09:04:44 +0900
332
+
333
+
334
+
335
+ check_user_agent_for_mobileとcurrent_photographerメソッドが呼ばれる場合のログ(class PhotographersController内のコードにスペースを入れたりすると、呼ばれる)
336
+
337
+
338
+
339
+ > D, [2019-06-14T09:17:24.282129 #29691] DEBUG -- :
340
+
341
+ D, [2019-06-14T09:17:24.284610 #29691] DEBUG -- :
342
+
343
+ I, [2019-06-14T09:17:24.288359 #29691] INFO -- : Started GET "/photographer/distributions/2/schedule" for 127.0.0.1 at 2019-06-14 09:17:24 +0900
344
+
345
+ I, [2019-06-14T09:17:26.561787 #29691] INFO -- : Processing by Photographer::DistributionsController#schedule as HTML
346
+
347
+ I, [2019-06-14T09:17:26.562443 #29691] INFO -- : Parameters: {"id"=>"2"}
348
+
349
+ D, [2019-06-14T09:17:26.648209 #29691] DEBUG -- : Photographer Load (0.7ms) SELECT `photographers`.* FROM `photographers` WHERE `photographers`.`id` = 2 LIMIT 1
350
+
351
+ D, [2019-06-14T09:17:26.669742 #29691] DEBUG -- : PhotographersDistribution Load (0.5ms) SELECT `photographers_distributions`.* FROM `photographers_distributions` WHERE `photographers_distributions`.`photographer_id` = 2 AND `photographers_distributions`.`status_id` = 3 AND (`photographers_distributions`.`selected_at` BETWEEN '2019-06-14 00:00:00' AND '2019-06-14 23:59:59') ORDER BY `photographers_distributions`.`selected_at` DESC
352
+
353
+ D, [2019-06-14T09:17:26.675389 #29691] DEBUG -- : (1.3ms) SELECT COUNT(*) AS count_all, DATE(created_at) AS date_created_at FROM `photographers_distributions` WHERE `photographers_distributions`.`photographer_id` = 2 AND `photographers_distributions`.`status_id` = 3 AND (`photographers_distributions`.`selected_at` BETWEEN '2019-06-14 00:00:00' AND '2019-06-14 23:59:59') GROUP BY DATE(created_at) ORDER BY `photographers_distributions`.`selected_at` DESC
354
+
355
+ D, [2019-06-14T09:17:26.676793 #29691] DEBUG -- : (0.4ms) SELECT COUNT(*) FROM `photographers_distributions` WHERE `photographers_distributions`.`photographer_id` = 2 AND `photographers_distributions`.`status_id` = 3 AND (`photographers_distributions`.`selected_at` BETWEEN '2019-06-14 00:00:00' AND '2019-06-14 23:59:59') AND `photographers_distributions`.`over_transit_time_flg` = 1
356
+
357
+ D, [2019-06-14T09:17:26.698022 #29691] DEBUG -- : (0.5ms) SELECT COUNT(*) FROM `photographers_distributions` WHERE `photographers_distributions`.`photographer_id` = 2 AND `photographers_distributions`.`status_id` = 3 AND (`photographers_distributions`.`selected_at` BETWEEN '2019-06-14 00:00:00' AND '2019-06-14 23:59:59')
358
+
359
+ I, [2019-06-14T09:17:26.716581 #29691] INFO -- : Rendered photographer/distributions/schedule.html+mobile.erb within layouts/photographers_distribution (24.0ms)
360
+
361
+ I, [2019-06-14T09:17:27.008918 #29691] INFO -- : Completed 200 OK in 446ms (Views: 331.1ms | ActiveRecord: 39.9ms)
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+
370
+
371
+ ###問題点
372
+
373
+ ログインしてビューにリダイレクトした際、
374
+
375
+ 1. check_user_agent_for_mobileメソッドが呼ばれないためschedule.html+mobile.erbではなくschedule.html.erbが呼ばれる
376
+
377
+ 2. class Photographer::ApplicationControllerのcurrent_photographerメソッドが呼ばれない
378
+
379
+
380
+
381
+ といった問題が起こっています。
292
382
 
293
383
 
294
384
 
@@ -296,7 +386,13 @@
296
386
 
297
387
 
298
388
 
389
+ 実現したいこと
390
+
391
+
392
+
299
- 最初からschedule.html+mobile.erbに飛ぶようにしたいです。
393
+ 1. ログインした際にschedule.html+mobile.erbに飛ぶようにしたい
394
+
395
+ 2. class Photographer::ApplicationControllerのcurrent_photographerメソッドが呼ばれるようにしたい
300
396
 
301
397
 
302
398
 

4

修正

2019/06/14 00:19

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -20,16 +20,16 @@
20
20
 
21
21
  namespace :photographer do
22
22
 
23
- resources :distributions
23
+ resources :distributions do
24
+
25
+ get 'schedule'
26
+
27
+ end
24
28
 
25
29
  end
26
30
 
27
31
 
28
32
 
29
- get '/photographer/:id/distributions/schedule' => 'photographer/distributions#schedule', as: 'photographer_schedule'
30
-
31
-
32
-
33
33
  get 'photographer_login' => 'photographers#login_form'
34
34
 
35
35
  post 'photographer_login' => 'photographers#login'

3

文章修正

2019/06/11 00:38

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -210,8 +210,6 @@
210
210
 
211
211
  def index
212
212
 
213
- @title = '撮影'
214
-
215
213
  @dists = PhotographersDistribution.where(display_flg: true).order(id: :desc)
216
214
 
217
215
  end
@@ -220,8 +218,6 @@
220
218
 
221
219
  def show
222
220
 
223
- @title = '撮影詳細'
224
-
225
221
  @dist = PhotographersDistribution.find(params[:id])
226
222
 
227
223
  end
@@ -232,8 +228,6 @@
232
228
 
233
229
  @current_photographer = Photographer.find(session[:p_id])
234
230
 
235
- @title = '撮影予定'
236
-
237
231
  @dists = PhotographersDistribution.where(photographer_id: @current_photographer.id).order(created_at: :desc)
238
232
 
239
233
  @total_fee = @dists.map{|x| x.payment_fee}.sum
@@ -250,11 +244,11 @@
250
244
 
251
245
  if dist.update(photographer_id: @current_photographer.id, display_flg: false)
252
246
 
253
- redirect_to photographer_distributions_path, notice: "撮影予定に入りました"
247
+ redirect_to photographer_distributions_path
254
248
 
255
249
  else
256
250
 
257
- redirect_to photographer_distributions_path, alert: "撮影予定に入りませんでした"
251
+ redirect_to photographer_distributions_path
258
252
 
259
253
  end
260
254
 
@@ -276,7 +270,7 @@
276
270
 
277
271
  respond_to do |format|
278
272
 
279
- format.html { redirect_to photographer_schedule_url, notice: "削除しました。" }
273
+ format.html { redirect_to photographer_schedule_url }
280
274
 
281
275
  format.json { head :no_content }
282
276
 
@@ -294,7 +288,11 @@
294
288
 
295
289
  ###実現したいこと
296
290
 
297
- ログインしてビューにリダイレクトした際、check_user_agent_for_mobileメソッドが呼ばれず、schedule.html+mobile.erbではなくschedule.html.erbが呼ばれます。ページを更新しても変化はないのですが、photographer::DistributionsControllerのコードの一部を変更(スペースを入れるなど)すると、schedule.html+mobile.erbが呼ばれます。
291
+ ログインしてビューにリダイレクトした際、check_user_agent_for_mobileメソッドが呼ばれず、schedule.html+mobile.erbではなくschedule.html.erbが呼ばれます。
292
+
293
+
294
+
295
+ ページを更新しても変化はないのですが、photographer::DistributionsControllerのコードの一部を変更(スペースを入れるなど)すると、schedule.html+mobile.erbが呼ばれます。
298
296
 
299
297
 
300
298
 

2

文章の修正

2019/06/04 08:32

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -294,7 +294,7 @@
294
294
 
295
295
  ###実現したいこと
296
296
 
297
- ログインしてビューにリダイレクトした際、check_user_agent_for_mobileメソッドが呼ばれず、schedule.html+mobile.erbではなくschedule.html.erbが呼ばれます。ページを更新しても変化はないのですが、hotographer::DistributionsControllerのコードの一部を変更(スペースを入れるなど)すると、schedule.html+mobile.erbが呼ばれます。
297
+ ログインしてビューにリダイレクトした際、check_user_agent_for_mobileメソッドが呼ばれず、schedule.html+mobile.erbではなくschedule.html.erbが呼ばれます。ページを更新しても変化はないのですが、photographer::DistributionsControllerのコードの一部を変更(スペースを入れるなど)すると、schedule.html+mobile.erbが呼ばれます。
298
298
 
299
299
 
300
300
 

1

文章修正

2019/06/04 08:27

投稿

s_diff
s_diff

スコア107

test CHANGED
File without changes
test CHANGED
@@ -210,7 +210,7 @@
210
210
 
211
211
  def index
212
212
 
213
- @title = '撮影案件リスト'
213
+ @title = '撮影'
214
214
 
215
215
  @dists = PhotographersDistribution.where(display_flg: true).order(id: :desc)
216
216
 
@@ -220,7 +220,7 @@
220
220
 
221
221
  def show
222
222
 
223
- @title = '撮影案件詳細'
223
+ @title = '撮影詳細'
224
224
 
225
225
  @dist = PhotographersDistribution.find(params[:id])
226
226