Files
openfoodnetwork/app/models/spree/zone_member.rb
Maikel Linke 1364b878fe Add ApplicationRecord for customisations
Rails 5 introduced this new class to confine application-specific monkey
patches to our models only, and not leak into other libraries using
ActiveRecord::Base.

https://bigbinary.com/blog/application-record-in-rails-5
2021-04-15 15:59:03 +10:00

15 lines
310 B
Ruby

# frozen_string_literal: true
module Spree
class ZoneMember < ApplicationRecord
belongs_to :zone, class_name: 'Spree::Zone', counter_cache: true, inverse_of: :zone_members
belongs_to :zoneable, polymorphic: true
def name
return nil if zoneable.nil?
zoneable.name
end
end
end