Module: Interest::Blockable::Blockee::ClassMethods

Defined in:
lib/interest/blockable/blockee.rb

Instance Method Summary collapse

Instance Method Details

#define_blockee_association_method(source_type) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/interest/blockable/blockee.rb', line 28

def define_blockee_association_method(source_type)
  association_method_name = blockee_association_method_name_for source_type

  has_many association_method_name,
    -> { uniq },
    through:     :blocker_relationships,
    source:      :blocker,
    source_type: source_type
end

#define_blockee_association_methodsObject



18
19
20
21
22
23
24
25
26
# File 'lib/interest/blockable/blockee.rb', line 18

def define_blockee_association_methods
  has_many :blocker_relationships,
    -> { uniq },
    as:          :blockee,
    dependent:   :destroy,
    class_name:  Interest.blocking_class_name do
      include Interest::Definition.collection_methods_for(:blocker)
    end
end