tickets/app/models/ticket_query_response.rb

19 lines
445 B
Ruby
Raw Normal View History

2015-08-03 10:54:33 +00:00
class TicketQueryResponse
include Mongoid::Document
include Mongoid::Timestamps
field :response
2015-08-25 10:49:47 +00:00
field :internal_response, type: Boolean, :default => false
2015-08-03 10:54:33 +00:00
field :response_by, type: BSON::ObjectId
2015-08-25 10:49:47 +00:00
field :user_tags, type: Array, default: []
2015-09-02 10:16:01 +00:00
field :read_by, type: Array, default: []
2015-08-25 10:49:47 +00:00
scope :for_clients, ->{ where(:internal_response.in => [nil, false]) }
2015-08-03 10:54:33 +00:00
belongs_to :ticket_query
2017-04-12 11:43:24 +00:00
def author
User.find(self.response_by)
end
2015-08-03 10:54:33 +00:00
end