tickets/app/models/ticket_query_response.rb

19 lines
445 B
Ruby

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
def author
User.find(self.response_by)
end
end