-
-
Save jfryman/250f6c7d358855e0242f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class XXX < ActiveRecord::Base | |
CONTACT_METHODS = [:snail_mail, :carrier_pigeon, :telegram] | |
attr_reader :requested_mode | |
enum :fulfilled_mode, CONTACT_METHODS | |
enum :requested_mode, CONTACT_METHODS | |
# Associations | |
belongs_to :assignee, :class_name => 'User' | |
belongs_to :client, :class_name => 'User' | |
# Validations | |
validates_presence_of :name | |
validates_presence_of :description | |
validates_presence_of :requested_mode | |
validates_inclusion_of :fulfilled_mode, :in => CONTACT_METHODS, :message => "Fulfilled mode must be one of the following: #{CONTACT_METHODS.join(',')}" | |
validates_inclusion_of :requested_mode, :in => CONTACT_METHODS, :message => "Requested mode must be one of the following: #{CONTACT_METHODS.join(',')}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment