質問編集履歴
1
インデントとendを追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
### 曜日による分岐をスッキリさせたい
|
2
2
|
現状
|
3
3
|
```
|
4
|
-
|
4
|
+
if Time.zone.today.sunday?
|
5
|
-
|
5
|
+
duty = "資源ごみ"
|
6
|
-
|
6
|
+
toban = Tobanhyo.where(role: 1)
|
7
|
-
|
7
|
+
elsif Time.zone.today.tuesday?
|
8
|
-
|
8
|
+
duty = "火曜のゴミ"
|
9
|
-
|
9
|
+
toban = Tobanhyo.where(role: 2)
|
10
|
-
|
10
|
+
elsif Time.zone.today.wednesday?
|
11
|
-
|
11
|
+
duty = "木曜日のゴミ"
|
12
|
-
|
12
|
+
toban = Tobanhyo.where(role: 3)
|
13
|
-
|
13
|
+
elsif Time.zone.today.Thursday? || Time.zone.today.friday?
|
14
|
-
|
14
|
+
duty = "燃えるゴミ"
|
15
|
-
|
15
|
+
toban = Tobanhyo.where(role: 4)
|
16
|
+
end
|
16
17
|
```
|
17
18
|
理想
|
18
19
|
```
|