Module: Followability::Followable
- Defined in:
- lib/followability/followable.rb,
lib/followability/followable/callbacks.rb,
lib/followability/followable/associations.rb,
lib/followability/followable/actions/block.rb,
lib/followability/followable/actions/common.rb,
lib/followability/followable/actions/follow.rb
Defined Under Namespace
Modules: Actions, Associations, Callbacks
Instance Method Summary collapse
-
#followability ⇒ Object
rubocop:disable Metrics/MethodLength, Metrics/BlockLength.
- #followability? ⇒ Boolean
Instance Method Details
#followability ⇒ Object
rubocop:disable Metrics/MethodLength, Metrics/BlockLength
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/followability/followable.rb', line 10 def followability class_eval do def self.followability? true end has_many :followerable_relationships, as: :followerable, class_name: 'Followability::Relationship', dependent: :destroy has_many :followable_relationships, as: :followable, class_name: 'Followability::Relationship', dependent: :destroy has_many :followers, -> { Followability::Relationship.following }, through: :followable_relationships, source: :followerable, class_name: name, source_type: name has_many :following, -> { Followability::Relationship.following }, through: :followerable_relationships, source: :followable, class_name: name, source_type: name has_many :blocks, -> { Followability::Relationship.blocked }, through: :followerable_relationships, source: :followable, class_name: name, source_type: name has_many :blockers, -> { Followability::Relationship.blocked }, through: :followable_relationships, source: :followerable, class_name: name, source_type: name end include Followability::Followable::Associations include Followability::Followable::Callbacks include Followability::Followable::Actions::Common include Followability::Followable::Actions::Follow include Followability::Followable::Actions::Block end |
#followability? ⇒ Boolean
5 6 7 |
# File 'lib/followability/followable.rb', line 5 def followability? false end |