Module: OneTouch::AsFavorHost
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/one_touch/models/as_favor_host.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#favor?(target, context) ⇒ Boolean
check favor exist or not params is context and target.
-
#find_favor(target, context) ⇒ Object
find the favor to target with specific context return ARelation object.
Instance Method Details
#favor?(target, context) ⇒ Boolean
check favor exist or not params is context and target
68 69 70 |
# File 'lib/one_touch/models/as_favor_host.rb', line 68 def favor?(target,context) find_favor(target,context).present? ? true : false end |
#find_favor(target, context) ⇒ Object
find the favor to target with specific context return ARelation object
62 63 64 |
# File 'lib/one_touch/models/as_favor_host.rb', line 62 def find_favor(target,context) favors.scoped.merge(Favor.context_as(context).favorable_as(target)) end |