Skip to content
Snippets Groups Projects

Add a Tag Name filter to the Incident Timeline API

7 unresolved threads
1 file
+ 2
2
Compare changes
  • Side-by-side
  • Inline
@@ -29,12 +29,12 @@ class TimelineEvent < ApplicationRecord
through: :timeline_event_tag_links
scope :order_occurred_at_asc_id_asc, -> { reorder(occurred_at: :asc, id: :asc) }
scope :with_tags, -> (tag_name) do # is there a naming convention for this?
scope :with_tags, ->(tag_name) do # is there a naming convention for this?
joins(:timeline_event_tags).where(timeline_event_tags: { name: tag_name })
end
# example:
# in environment.rb
# in app/models/environment.rb
# scope :without_names, -> (names) do
# where.not(name: names)
# end
Loading