class StudentAssignment
include Mongoid::Document
include Mongoid::Timestamps
include Slug
field :assignment_content, as: :slug_title, type: String, default: ""
has_many :student_assignment_files, :dependent => :destroy, :autosave => true
accepts_nested_attributes_for :student_assignment_files, :allow_destroy => true
belongs_to :course_assignment
belongs_to :member_profile
def display_created_at
self.created_at.strftime("%Y-%m-%d %H:%M")
end
def display_updated_at
self.updated_at.strftime("%Y-%m-%d %H:%M")
end
def display_student_assignment_files
self.student_assignment_files.map{ |f|
next if f.file.file.nil?
title = (f.title.blank? ? f.file.file.original_filename : f.title)
"#{title}"
}.join("
").html_safe
end
end