Sha256: 760d7dddbf593c5e1579b2adf1a4713d44f08345924ae316e7c3c405fb5a8447

Contents?: true

Size: 578 Bytes

Versions: 1

Compression:

Stored size: 578 Bytes

Contents

# frozen_string_literal: true

require 'adaptive_alias/patches/base'

module AdaptiveAlias
  module Patches
    class ForwardPatch < Base
      def apply!
        AdaptiveAlias.current_patches[[@klass, @old_column, @new_column]] = self
        @klass.alias_attribute(@new_column, @old_column)
        add_hooks!(current_column: @old_column, alias_column: @new_column)
      end

      def remove!
        super
        @klass.remove_alias_attribute(@new_column)
        BackwardPatch.new(@klass, @old_column, @new_column).apply!
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adaptive_alias-0.0.3 lib/adaptive_alias/patches/forward_patch.rb