client.rb 516 Bytes
Newer Older
1
class Client < ApplicationRecord
2
  include AssociatableFields
Chrysanthi Lagodimou's avatar
Chrysanthi Lagodimou committed
3
  include FullName
4
5
  include GenderCollection

6
7
8
9
10
11
12
  REGISTERED = 'registered'.freeze
  RESERVED = 'reserved'.freeze
  ACTIVE = 'active'.freeze
  FINISHED = 'finished'.freeze
  REJECTED = 'rejected'.freeze
  STATES = [REGISTERED, RESERVED, ACTIVE, FINISHED, REJECTED].freeze

Chrysanthi Lagodimou's avatar
Chrysanthi Lagodimou committed
13
  belongs_to :user
Tugce Nur Tas's avatar
Tugce Nur Tas committed
14

15
  validates :first_name, :last_name, presence: true
16
17
18
19
20
  validates :state, inclusion: { in: STATES }

  def self.state_collection
    STATES.map(&:to_sym)
  end
21
end