@kcne commented on this pull request.
> @@ -34,6 +34,16 @@ class Note < ApplicationRecord
scope :visible, -> { where.not(:status => "hidden") }
scope :invisible, -> { where(:status => "hidden") }
+ scope :with_status, lambda { |status|
+ case status
+ when "open"
+ where(:status => "open")
+ when "closed"
+ where(:status => "closed")
+ else
+ all
+ end
+ }
Fixed and updated the PR. Since this is the only place using the scope, I
removed it to simplify the code and maintain consistency. If a need arises, we
can reintroduce it later.
Also, I’ve added a test in the controller to cover the basic status filtering
functionality. Let me know if further tests are needed.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5297#discussion_r1831242593
You are receiving this because you are subscribed to this thread.
Message ID:
<openstreetmap/openstreetmap-website/pull/5297/review/2418659...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev