Class: MongoidForums::Category

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

Instance Method Summary collapse

Instance Method Details

#moderator?(user) ⇒ Boolean

Returns:

  • (Boolean)

15
16
17
18
19
20
21
# File 'app/models/mongoid_forums/category.rb', line 15

def moderator?(user)
  return false unless user
  moderator_groups.each do |group|
    return true if group.moderator && group.members.include?(user.id)
  end
  false
end

#moderatorsObject


23
24
25
26
27
28
29
# File 'app/models/mongoid_forums/category.rb', line 23

def moderators
  array = Array.new
  self.moderator_groups.each do |g|
    array << g.group.members
  end
  return array
end