Module: ForumReader

Defined in:
lib/forum_reader.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/forum_reader.rb', line 3

def self.included(base)
  base.class_eval {
    has_many :posts, :order => 'posts.created_at desc', :dependent => :nullify
    
    named_scope :most_commenting, lambda { |count|
      {
        :select => "readers.*, count(posts.id) AS post_count", 
        :joins => "INNER JOIN posts ON posts.reader_id = readers.id",
        :group => "readers.id",
        :order => "post_count DESC",
        :limit => count
      }
    }
  }
end

Instance Method Details

#is_moderator?(thing = nil) ⇒ Boolean

This will get more useful soon. For now I’m just establishing an interface. Moderation will be a global flag but can also come from group-leadership or forum-ownership

Returns:

  • (Boolean)


22
23
24
# File 'lib/forum_reader.rb', line 22

def is_moderator?(thing=nil)
  true if is_admin?
end