Skip to content

Instantly share code, notes, and snippets.

@wprater
Created Apr 23, 2010
Embed
What would you like to do?
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