Files
openfoodnetwork/app/models/spree/country.rb
Maikel Linke cb3cd3e7ea Cache default country simply in memory
This simplifies the code, avoids a method naming collision with Rails
and should be faster as well.
2024-01-04 13:45:36 +11:00

18 lines
293 B
Ruby

# frozen_string_literal: true
module Spree
class Country < ApplicationRecord
has_many :states, -> { order('name ASC') }, dependent: :destroy
validates :name, :iso_name, presence: true
def <=>(other)
name <=> other.name
end
def to_s
name
end
end
end