Sha256: 515f2c2e78e05d81023432df941137e8c9eabbe4d55e53c4aab198449c21ae7a

Contents?: true

Size: 765 Bytes

Versions: 3

Compression:

Stored size: 765 Bytes

Contents

module Comable
  class Order < ActiveRecord::Base
    module DeprecatedMethods
      extend ActiveSupport::Concern

      def shipment
        shipments.first
      end

      def shipment=(shipment)
        shipments << shipment unless shipments.include? shipment
      end

      included do
        delegate :state, :human_state_name, to: :shipment, allow_nil: true, prefix: true

        #
        # Deprecated methods
        #
        deprecate :shipment, deprecator: Comable::Deprecator.instance
        deprecate :shipment=, deprecator: Comable::Deprecator.instance
        deprecate :shipment_state, deprecator: Comable::Deprecator.instance
        deprecate :shipment_human_state_name, deprecator: Comable::Deprecator.instance
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
comable-core-0.7.1 app/models/comable/order/deprecated_methods.rb
comable-core-0.7.0 app/models/comable/order/deprecated_methods.rb
comable-core-0.7.0.beta2 app/models/comable/order/deprecated_methods.rb