Sha256: 80f43085e8de1f933935e8ee4c79af1cacd5c89096b6684b352254043a9295c0
Contents?: true
Size: 405 Bytes
Versions: 2
Compression:
Stored size: 405 Bytes
Contents
# 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 # Filter by name scope :filter, ->(fname) { where(["name_en = :name or name = :name", name: fname]) } end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
china_regions-1.0.7 | app/models/province.rb |
china_regions-1.0.5 | app/models/province.rb |