Skip to content

Commit 1caa3e8

Browse files
committed
ordering listed lessons by created_at timestamp
1 parent 972f1cd commit 1caa3e8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/controllers/api/lessons_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ class LessonsController < ApiController
99
def index
1010
archive_scope = params[:include_archived] == 'true' ? Lesson : Lesson.unarchived
1111
scope = params[:school_class_id] ? archive_scope.where(school_class_id: params[:school_class_id]) : archive_scope
12-
@lessons_with_users = scope.accessible_by(current_ability).with_users
12+
ordered_scope = scope.order(created_at: :asc)
13+
@lessons_with_users = ordered_scope.accessible_by(current_ability).with_users
1314
render :index, formats: [:json], status: :ok
1415
end
1516

0 commit comments

Comments
 (0)