Skip to content

Instantly share code, notes, and snippets.

@mjtko
Created April 19, 2012 17:53
Show Gist options
  • Save mjtko/2422598 to your computer and use it in GitHub Desktop.
Save mjtko/2422598 to your computer and use it in GitHub Desktop.
class Contact < ActiveRecord::Base
validates :dob, :presence => true, :if => :is_patient?
validates :contact_type_id, :first_name, :last_name, :presence => true
has_many :calls
belongs_to :contact_type
def is_patient?
(contact_type_id == 1).tap { |r| STDERR.puts "is_patient? returning #{r} for #{self.inspect} with contact_type_id: #{contact_type_id}" }
end
def full_name
first_name + " " + last_name
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment