Module: Gluttonberg::CanFlag::CanFlagMixin

Extended by:
ActiveSupport::Concern
Defined in:
lib/gluttonberg/can_flag.rb

Instance Method Summary collapse

Instance Method Details

#flagged?(content) ⇒ Boolean

Returns:

  • (Boolean)


69
70
71
72
# File 'lib/gluttonberg/can_flag.rb', line 69

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

#flagged_by?(content, user) ⇒ Boolean

Returns:

  • (Boolean)


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

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