Sha256: 7d9b63e233c8b42750f8f7b5df4bb803721b9bd91673a6480be5241a934a3761
Contents?: true
Size: 725 Bytes
Versions: 2
Compression:
Stored size: 725 Bytes
Contents
module MongoidForums class Category include Mongoid::Document has_many :forums, :class_name => "MongoidForums::Forum", dependent: :destroy has_and_belongs_to_many :moderator_groups, :class_name => "MongoidForums::Group", inverse_of: nil field :name validates :name, :presence => true field :order, :type => Integer, :default => 0 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 def moderators array = Array.new self.moderator_groups.each do |g| array << g.group.members end return array end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mongoid-forums-0.0.5 | app/models/mongoid_forums/category.rb |
mongoid-forums-0.0.4 | app/models/mongoid_forums/category.rb |