Files
openfoodnetwork/app/models/concerns/set_unused_address_fields.rb
2021-10-25 21:28:28 -05:00

17 lines
362 B
Ruby

# frozen_string_literal: true
require 'active_support/concern'
module SetUnusedAddressFields
extend ActiveSupport::Concern
included do
before_validation :set_unused_address_fields
end
def set_unused_address_fields
ship_address.company = 'unused' if ship_address.present?
bill_address.company = 'unused' if bill_address.present?
end
end