Module: OneTouch::AsFavorable

Extended by:
ActiveSupport::Concern
Defined in:
lib/one_touch/models/as_favorable.rb

Overview

Following are all queries # we should list dependency about these queries

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#favored_by?(ahost, context = default_context_in_favorable) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/one_touch/models/as_favorable.rb', line 42

def favored_by?(ahost, context= default_context_in_favorable)
  (be_favors.scoped.merge(Favor.host_as(ahost).context_as(context))).present?
end

#favorers(host = default_host, context = default_context_in_favorable) ⇒ Object

Return host list

same method to Host.favor_to, but different aspect


38
39
40
# File 'lib/one_touch/models/as_favorable.rb', line 38

def favorers(host = default_host, context = default_context_in_favorable)
  host.favor_to(self, context)
end

#favors_count(cont = default_context_in_favorable) ⇒ Object

End ClassMethods



32
33
34
# File 'lib/one_touch/models/as_favorable.rb', line 32

def favors_count(cont=default_context_in_favorable)
  be_favors.context_as(cont).count
end