Method: OneTouch::AsFavorHost::ClassMethods#favor_to
- Defined in:
- lib/one_touch/models/as_favor_host.rb
#favor_to(favorable, context = default_context_in_host) ⇒ Object
TODO
favor_to(@favorable, focus) could extend to focus_to(@favorable)
favor_to(@favorable, like) could extend to like_to(@favorable)
means add more dynamic methods relies on context
Ex:
User.favor_to(@user1, :follow)
=> return guys(an ActiveRelation object) who follows @user1, so you can define fans
27 28 29 |
# File 'lib/one_touch/models/as_favor_host.rb', line 27 def favor_to(favorable,context=default_context_in_host) host_context_as(context).merge(Favor.favorable_as favorable) end |