Sha256: 7224eec73eda0a0f903c27510d38efc758e28de5dd453958be399905e85a91d9
Contents?: true
Size: 707 Bytes
Versions: 2
Compression:
Stored size: 707 Bytes
Contents
class Person < ActiveRecord::Base has_many :group_people, dependent: :destroy, autosave: true has_many :groups, through: :group_people has_many :owned_groups, class_name: 'Group', foreign_key: 'owner_id', dependent: :nullify, autosave: true validates :first_name, presence: true, length: { in: 2..254 } validates :last_name, presence: true, length: { in: 2..254 } validates :sex, presence: true, length: { is: 1 }, inclusion: { in: %w(m f o), message: 'one of m (male), f (female), or o (other)' } validate :valid_date_of_birth? def valid_date_of_birth? return date_of_birth.nil? || (date_of_birth.is_a?(Date) && date_of_birth < Date.current) end private :valid_date_of_birth? end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kadmin-0.1.7 | test/dummy/app/models/person.rb |
kadmin-0.1.6 | test/dummy/app/models/person.rb |