Files
Dalan/app/models/province.rb
2026-08-13 19:56:46 +03:30

22 lines
596 B
Ruby

class Province < ApplicationRecord
has_many :cities
validates :name, presence: true,
length: 1..255,
format: {
with: /\A[[:word:]\s\-']+\z/,
message: 'only allows letters, digits "-", "\'", and space'
}
end
# == Schema Information
# Schema version: 20210420111532
#
# Table name: provinces
#
# id :bigint not null, primary key
# name :string(255)
# created_at :datetime not null
# updated_at :datetime not null
#