Module: Gluttonberg::CanFlag::InstanceMethods

Defined in:
lib/gluttonberg/can_flag.rb

Overview

This module contains instance methods

Instance Method Summary collapse

Instance Method Details

#flagged=(by_who) ⇒ Object

Flag content with a mass-updater; sets the flagging user. article.update_attributes { ‘flagged’ => current_user.id }



85
86
87
# File 'lib/gluttonberg/can_flag.rb', line 85

def flagged=(by_who)
  flags.build :user_id => by_who
end

#flagged?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/gluttonberg/can_flag.rb', line 75

def flagged?
  flags.size > 0
end

#inappropriate?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/gluttonberg/can_flag.rb', line 79

def inappropriate?
  flags.find_all{|f| f.approved == true }.size > 0
end