Module: Caboose::Can::Flag::CanFlagInstanceMethods

Defined in:
lib/can_flag.rb

Instance Method Summary collapse

Instance Method Details

#flagged?(content) ⇒ Boolean

Returns:

  • (Boolean)


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

def flagged?(content)
  logger.warn "Looking for flags with #{content.inspect} #{content.class.name}"
  ::Flag.find(:first,
    :conditions => { :flaggable_type => content.class.name, :flaggable_id => content[:id] })
end

#flagged_by?(content, user) ⇒ Boolean

Returns:

  • (Boolean)


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

def flagged_by?(content, user)
  ::Flag.find(:first,
    :conditions => { :flaggable_type => content.class.name, :flaggable_id => content[:id], :flaggable_user_id => user.id })
end