From 1c6d1500c0507239431716e8bca8b0a4c80e9e4d Mon Sep 17 00:00:00 2001 From: James Beavers Date: Sun, 21 Sep 2014 04:24:41 -0400 Subject: [PATCH] Update associations --- app/models/resume.rb | 3 ++- app/models/skill.rb | 1 + app/models/user.rb | 5 ++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models/resume.rb b/app/models/resume.rb index 6f0f313..471446c 100644 --- a/app/models/resume.rb +++ b/app/models/resume.rb @@ -1,5 +1,6 @@ class Resume < ActiveRecord::Base - belongs_to :jobseekers + belongs_to :users validates :title, :presence => true, :length => {:maximum => 128} validates :body, :presence => true, :length => {:maximum => 10000} + validates :owner_id, :presence => true end diff --git a/app/models/skill.rb b/app/models/skill.rb index f60b98a..3513ac6 100644 --- a/app/models/skill.rb +++ b/app/models/skill.rb @@ -1,2 +1,3 @@ class Skill < ActiveRecord::Base + has_and_belongs_to_many :users end \ No newline at end of file diff --git a/app/models/user.rb b/app/models/user.rb index 3ce01b7..0664d26 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,8 +1,7 @@ class User < ActiveRecord::Base - has_and_belongs_to_many :roles + has_and_belongs_to_many :roles, :skills, :jobs has_many :permissions, :through => :roles - has_many :skills - has_and_belongs_to_many :jobs + has_one :resume, :foreign_key => :owner_id accepts_nested_attributes_for :roles accepts_nested_attributes_for :skills