diff --git a/app/models/person.rb b/app/models/person.rb index aceb16a..2ffc21a 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -8,16 +8,16 @@ class Person < ActiveRecord::Base avatar_file_name: 1, bio: 20, company_name: 1, - email: 15, + email: 15, featured: 1000, - first_name: 5, + first_name: 5, gravatar_image_found: 3, interests: 1, - last_name: 5, - phone: 0, + last_name: 5, + phone: 0, roles: 1, - skills: 1, - title: 1, + skills: 1, + title: 1, twitter_username: 5, website: 1 } @@ -37,11 +37,11 @@ class Person < ActiveRecord::Base scope :featured, -> { where(featured: true) } scope :not_featured, -> { where(featured: false) } - scope :with_interests, -> { includes(:interests) } - scope :with_skills, -> { includes(:skills) } + scope :with_interests, -> { references(:tags).includes(:interests) } + scope :with_skills, -> { references(:tags).includes(:skills) } scope :with_news, -> { includes(:news) } scope :with_events, -> { includes(:events) } - scope :with_associations, -> { + scope :with_associations, -> { with_events .with_news .with_interests