class GroupPost include Mongoid::Document include Mongoid::Timestamps include Slug field :title, as: :slug_title, type: String field :content field :read_by, type: Array, default: [] field :author, type: BSON::ObjectId belongs_to :group has_many :group_post_images, :autosave => true, :dependent => :destroy has_many :group_post_files, :autosave => true, :dependent => :destroy has_many :group_post_comments, :autosave => true, :dependent => :destroy end