Skip to content

Commit 55154e1

Browse files
committed
order tasks and task_steps by creation_date so that order doesnt change when their info is updated
1 parent 0c6776f commit 55154e1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/models/todoro/task.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Todoro
22
class Task < ApplicationRecord
33
belongs_to :task_list
44
has_many :reminders, dependent: :destroy
5-
has_many :task_steps, class_name: "Todoro::TaskStep", dependent: :destroy
5+
has_many :task_steps, -> { order(created_at: :desc) }, class_name: "Todoro::TaskStep", dependent: :destroy
66

77
has_many :task_assignments, dependent: :destroy
88

app/models/todoro/task_list.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Todoro
22
class TaskList < ApplicationRecord
33
belongs_to :taskable, polymorphic: true
4-
has_many :tasks, dependent: :destroy
4+
has_many :tasks, -> { order(created_at: :desc) }, dependent: :destroy
55

66
validates :name, presence: true
77
end

0 commit comments

Comments
 (0)