Skip to content

Instantly share code, notes, and snippets.

@wprater
Created April 23, 2010 18:06
Show Gist options
  • Save wprater/93e5858417bb14ec18c9 to your computer and use it in GitHub Desktop.
Save wprater/93e5858417bb14ec18c9 to your computer and use it in GitHub Desktop.
class Consultant < ActiveRecord::Base
has_one :recruiter, :class_name => "Contact", :foreign_key => "recruiter_contact_id"
has_one :client
has_many :consultants_projects
# We want all the fields on the consultants_projects association
has_many :projects,
:through => :consultants_projects,
:select => 'consultants_projects.*, projects.*'
validates_presence_of :first_name, :on => :create, :message => "can't be blank"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment