Files
openfoodnetwork/app/models/spree/concerns/payment_method_distributors.rb
Matt-Yorkley 3896644a04 Remove attr_accessible declarations
Needed for using Strong Parameters in Rails 4
2020-02-22 14:03:16 +01:00

15 lines
594 B
Ruby

require 'active_support/concern'
# This concern is used to duplicate the associations distributors and distributor_ids
# across payment method and gateway
# this fixes the inheritance problem https://github.com/openfoodfoundation/openfoodnetwork/issues/2781
module Spree::PaymentMethodDistributors
extend ActiveSupport::Concern
def self.included(base)
base.class_eval do
has_and_belongs_to_many :distributors, join_table: 'distributors_payment_methods', class_name: 'Enterprise', foreign_key: 'payment_method_id', association_foreign_key: 'distributor_id'
end
end
end