client_management/app/models/project_post.rb

23 lines
434 B
Ruby

class ProjectPost
include Mongoid::Document
include Mongoid::Timestamps
field :content
field :user_id
field :user_tags, type: Array, :default => []
field :internal_response, type: Boolean, :default => true
belongs_to :site_request
def my_post?(userid)
self.user_id == userid
end
def get_user
User.find(self.user_id) rescue nil
end
def tagged_users
User.find(self.user_tags) rescue []
end
end