app/models/mongoid_forums/post.rb in ack-mongoid-forums-1.0.5 vs app/models/mongoid_forums/post.rb in ack-mongoid-forums-1.0.6
- old
+ new
@@ -1,10 +1,15 @@
module MongoidForums
class Post
include Mongoid::Document
include Mongoid::Timestamps
+ include Enableable
+
+ field :is_deleted, type: Boolean, default: false
+ alias :deleted :is_deleted
+
after_create :set_topic_last_post_at
belongs_to :topic, :class_name => "MongoidForums::Topic"
belongs_to :user, :class_name => MongoidForums.user_class.to_s
@@ -30,11 +35,21 @@
def owner_or_admin?(other_user)
user == other_user || (other_user.mongoid_forums_admin? || topic.forum.moderator?(other_user))
end
+ rails_admin do
+ field :enabled, :toggle
+ field :is_deleted, :toggle
+ field :created_at
+ field :updated_at
+ field :topic
+ field :user
+ field :text
+ end
+
protected
def set_topic_last_post_at
self.topic.update_attribute(:last_post_at, self.created_at)
end
- end
+ end
end