about summary refs log tree commit diff
path: root/app/serializers/rest/filter_serializer.rb
blob: 98d7edb175a3c48862e4af2753c327d69b183b45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# frozen_string_literal: true

class REST::FilterSerializer < ActiveModel::Serializer
  attributes :id, :title, :context, :expires_at, :filter_action
  has_many :keywords, serializer: REST::FilterKeywordSerializer, if: :rules_requested?

  def id
    object.id.to_s
  end

  def rules_requested?
    instance_options[:rules_requested]
  end
end