From afcc6ce699cd51475acadfcd88027ff0e84a0aab Mon Sep 17 00:00:00 2001 From: Lorna Date: Mon, 24 Apr 2023 21:18:14 +0100 Subject: [PATCH] Use .sort_by instead of .order active_hash had an issue raised which seems to relate to the bug in production where .order method breaks finder, returning the wrong record for the given parameters https://github.com/active-hash/active_hash/issues/193 --- app/controllers/plants_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/plants_controller.rb b/app/controllers/plants_controller.rb index 9903c2e..c0ad865 100644 --- a/app/controllers/plants_controller.rb +++ b/app/controllers/plants_controller.rb @@ -14,7 +14,7 @@ def index end end - @plants = Plant.where(filter).order(week: :desc) + @plants = Plant.where(filter).sort_by(&:week).reverse end def show