Class: MongoidForums::Post

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps
Defined in:
app/models/mongoid_forums/post.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.by_created_atObject



22
23
24
# File 'app/models/mongoid_forums/post.rb', line 22

def by_created_at
  order_by([:created_at, :asc])
end

.by_updated_atObject



26
27
28
# File 'app/models/mongoid_forums/post.rb', line 26

def by_updated_at
  order_by([:updated_at, :desc])
end

Instance Method Details

#owner_or_admin?(other_user) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'app/models/mongoid_forums/post.rb', line 31

def owner_or_admin?(other_user)
  user == other_user || (other_user.mongoid_forums_admin? || topic.forum.moderator?(other_user))
end