Module: OneTouch::AsFavorable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/one_touch/models/as_favorable.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #favored_by?(ahost, context = default_context_in_favorable) ⇒ Boolean
-
#favorers(host = default_host, context = default_context_in_favorable) ⇒ Object
Return host list same method to Host.favor_to, but different aspect.
-
#favors_count(cont = default_context_in_favorable) ⇒ Object
End ClassMethods.
Instance Method Details
#favored_by?(ahost, context = default_context_in_favorable) ⇒ Boolean
41 42 43 |
# File 'lib/one_touch/models/as_favorable.rb', line 41 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
37 38 39 |
# File 'lib/one_touch/models/as_favorable.rb', line 37 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
31 32 33 |
# File 'lib/one_touch/models/as_favorable.rb', line 31 def favors_count(cont=default_context_in_favorable) be_favors.context_as(cont).count end |