class TicketQueryResponse include Mongoid::Document include Mongoid::Timestamps field :response field :internal_response, type: Boolean, :default => false field :response_by, type: BSON::ObjectId field :user_tags, type: Array, default: [] field :read_by, type: Array, default: [] scope :for_clients, ->{ where(:internal_response.in => [nil, false]) } belongs_to :ticket_query end