Module: Interest::FollowRequestable::FollowRequester::ClassMethods
- Defined in:
- lib/interest/follow_requestable/follow_requester.rb
Instance Method Summary collapse
- #define_follow_requester_association_method(source_type) ⇒ Object
- #define_follow_requester_association_methods ⇒ Object
Instance Method Details
#define_follow_requester_association_method(source_type) ⇒ Object
80 81 82 83 84 85 86 87 |
# File 'lib/interest/follow_requestable/follow_requester.rb', line 80 def define_follow_requester_association_method(source_type) association_method_name = follow_requester_association_method_name_for source_type has_many association_method_name, through: :outgoing_follow_requests, source: :followee, source_type: source_type end |
#define_follow_requester_association_methods ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'lib/interest/follow_requestable/follow_requester.rb', line 70 def define_follow_requester_association_methods has_many :outgoing_follow_requests, -> { where(followings: {status: "pending"}) }, as: :follower, dependent: :destroy, class_name: "Following" do include Interest::Definition.collection_methods_for(:followee) end end |