Skip to content
Snippets Groups Projects

Add a Tag Name filter to the Incident Timeline API

7 unresolved threads
1 file
+ 9
0
Compare changes
  • Side-by-side
  • Inline
@@ -29,5 +29,14 @@ 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?
joins(:timeline_event_tags).where(timeline_event_tags: { name: tag_name })
end
# example:
# in environment.rb
# scope :without_names, -> (names) do
# where.not(name: names)
# end
end
end
Loading