teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

コードを一部修正しました

2020/11/15 16:33

投稿

_Iwasaki_
_Iwasaki_

スコア9

title CHANGED
File without changes
body CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Lessonというモデルに、`lesson_day` という`Date`型のカラムがあるとします。
7
7
 
8
- `Lesson.where(lesson_day: Date.new(2020, 4, 1)..Date.new(2021, 3, 31)).group("extract(month from lesson_day)").order("extract_month_from_lesson_day DESC").count`
8
+ `Lesson.where(lesson_day: Date.new(2020, 4, 1)..Date.new(2021, 3, 31)).group("extract(month from lesson_day)").order("extract_month_from_lesson_day").count`
9
9
 
10
10
  と書いて、
11
11
  今年度の月別の、`lesson_day`の数を、年度別のため、4月を先頭に持ってきて集計することを期待していたのですが、