Class: SimpleForum::Forum

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/simple_forum/forum.rb

Instance Method Summary collapse

Instance Method Details

#moderated_by?(user) ⇒ Boolean Also known as: is_moderator?

Returns:

  • (Boolean)


45
46
47
48
49
50
51
52
53
# File 'app/models/simple_forum/forum.rb', line 45

def moderated_by?(user)
  return false unless user
  @moderated_by_cache ||= {}
  if @moderated_by_cache.has_key?(user.id)
    @moderated_by_cache[user.id]
  else
    @moderated_by_cache[user.id] = moderators.include?(user)
  end
end

#to_paramObject



40
41
42
# File 'app/models/simple_forum/forum.rb', line 40

def to_param
  "#{id}-#{name.to_s.parameterize}"
end