app/models/province.rb in china_regions-1.0.2 vs app/models/province.rb in china_regions-1.0.3
- old
+ new
@@ -1,6 +1,13 @@
# frozen_string_literal: true
class Province < ApplicationRecord
+ # Validations
+ validates :code, presence: true
+ validates :name, presence: true, uniqueness: {
+ case_sensitive: false
+ }
+
+ # Relationships
has_many :cities, dependent: :destroy
has_many :districts, through: :cities
end