Skip to content

Instantly share code, notes, and snippets.

@mike-bhs
mike-bhs / polymorphic_following.md
Last active February 1, 2018 20:40
Polymorphic following without dependencies on objects that are followed

##Polymorphic following without dependencies on objects that are followed followable_concern.rb

module FollowableConcern
  extend ActiveSupport::Concern

  included do
    has_many :personal_followers, class_name: 'Core::Follow', as: :followingable, dependent: :destroy
    has_many :personal_followings, class_name: 'Core::Follow', as: :followerable, dependent: :destroy