22 lines
596 B
Ruby
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
|
|
#
|