Module: Interest::FollowRequestable::FollowRequestee::ClassMethods
- Defined in:
- lib/interest/follow_requestable/follow_requestee.rb
Instance Method Summary collapse
- #define_follow_requestee_association_method(source_type) ⇒ Object
- #define_follow_requestee_association_methods ⇒ Object
Instance Method Details
#define_follow_requestee_association_method(source_type) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/interest/follow_requestable/follow_requestee.rb', line 33 def define_follow_requestee_association_method(source_type) association_method_name = follow_requestee_association_method_name_for source_type has_many association_method_name, -> { uniq }, through: :incoming_follow_requests, source: :follower, source_type: source_type end |
#define_follow_requestee_association_methods ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/interest/follow_requestable/follow_requestee.rb', line 23 def define_follow_requestee_association_methods has_many :incoming_follow_requests, -> { where(followings: {status: "pending"}).uniq }, as: :followee, dependent: :destroy, class_name: "Following" do include Interest::Definition.collection_methods_for(:follower) end end |