Advertisement
AndrewReshetov

Untitled

Dec 5th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.19 KB | None | 0 0
  1. diff --git a/app/models/person.rb b/app/models/person.rb
  2. index d29bb7a..944c28d 100644
  3. --- a/app/models/person.rb
  4. +++ b/app/models/person.rb
  5. @@ -63,13 +63,13 @@ class Person < User
  6.    end
  7.  
  8.    def subordinates
  9. -    scope = Person.eager_load(:information).where("#{PeopleInformation.table_name}.manager_id" => id.to_i)
  10. +    scope = Person.includes(:information).where("#{PeopleInformation.table_name}.manager_id" => id.to_i)
  11.      scope = scope.visible if Person.respond_to?(:visible)
  12.      scope
  13.    end
  14.  
  15.    def available_managers
  16. -    scope = Person.joins(:projects).eager_load(:information).where("#{Person.table_name}.type" => 'User').logged
  17. +    scope = Person.includes(:projects, :information).where("#{Person.table_name}.type" => 'User').logged
  18.      scope = scope.visible if Person.respond_to?(:visible)
  19.  
  20.      if self.id.present?
  21. @@ -79,7 +79,7 @@ class Person < User
  22.    end
  23.  
  24.    def available_subordinates
  25. -    scope = Person.eager_load(:information).where("#{Person.table_name}.type" => 'User').logged
  26. +    scope = Person.includes(:information).where("#{Person.table_name}.type" => 'User').logged
  27.      scope = scope.visible if Person.respond_to?(:visible)
  28.  
  29.      if self.id.present?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement