Sha256: 5bf81058e92a22ce4be96c64a7dde47a2d43555824d870bc7c99b919249e51ee

Contents?: true

Size: 610 Bytes

Versions: 1

Compression:

Stored size: 610 Bytes

Contents

class InscriptioCursualis::City < InscriptioCursualis::Model
  self.abstract_class = true

  has_paper_trail

  belongs_to :state, class_name: '::State'

  has_many :districts, class_name: '::District', dependent: :restrict_with_exception
  has_many :neighborhoods, class_name: '::Neighborhood', dependent: :restrict_with_exception
  has_many :streets, class_name: '::Street', dependent: :restrict_with_exception

  validates :name, :state, presence: true
  validates :name, uniqueness: { scope: :state_id }, allow_blank: true

  def self.active
    where(inactive: false)
  end

  def to_s
    name
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unico-training-7.8.0 app/models/inscriptio_cursualis/city.rb