module Shiftable

Usage:

class BlasterRounds < ActiveRecord::Base
  belongs_to :space_federation
  extend Shiftable::Collection.new(
          belongs_to: :space_federation,
          has_many: :blaster_rounds,
          method_prefix: "banana"
        )
end

Targets classes that have:

1. belongs_to association with a shift_to Model, e.g. Spaceship belongs to Captain, and
2. the shift_to Model, e.g. Captain, has_one Spaceship record

When the shift_to records (e.g. people) are merged,

these belongs_to/has_one associations must be carried over.

Usage:

class Spaceship < ActiveRecord::Base
  belongs_to :captain
  extend Shiftable::Single.new(
          belongs_to: :captain,
          has_one: :spaceship,
          precheck: true,
          before_shift: ->(shifting_rel) { shifting_rel.result..ownership_changes += 1 }
        )
end

Constants

VERSION