Commit 99bf0aae8c9705c6af625efe7a7d4393f02a9429
Committed by
Leandro Santos
1 parent
3590c1bd
Exists in
staging
and in
31 other branches
Fix problems with person = nil
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
app/models/organization.rb
@@ -18,7 +18,7 @@ class Organization < Profile | @@ -18,7 +18,7 @@ class Organization < Profile | ||
18 | # visible, public and enabled. | 18 | # visible, public and enabled. |
19 | def self.visible_for_person(person) | 19 | def self.visible_for_person(person) |
20 | # Visitor if person.nil? | 20 | # Visitor if person.nil? |
21 | - person.nil? ? person_id = nil : person_id = person.id | 21 | + person_id = person.nil? ? nil : person.id |
22 | joins('LEFT JOIN "role_assignments" ON ("role_assignments"."resource_id" = "profiles"."id" | 22 | joins('LEFT JOIN "role_assignments" ON ("role_assignments"."resource_id" = "profiles"."id" |
23 | AND "role_assignments"."resource_type" = \'Profile\') OR ( | 23 | AND "role_assignments"."resource_type" = \'Profile\') OR ( |
24 | "role_assignments"."resource_id" = "profiles"."environment_id" AND | 24 | "role_assignments"."resource_id" = "profiles"."environment_id" AND |
app/models/person.rb
@@ -43,7 +43,7 @@ class Person < Profile | @@ -43,7 +43,7 @@ class Person < Profile | ||
43 | 43 | ||
44 | scope :visible_for_person, lambda { |person| | 44 | scope :visible_for_person, lambda { |person| |
45 | # Visitor if person.nil? | 45 | # Visitor if person.nil? |
46 | - person.nil? ? person_id = nil : person_id = person.id | 46 | + person_id = person.nil? ? nil : person.id |
47 | joins('LEFT JOIN "role_assignments" ON | 47 | joins('LEFT JOIN "role_assignments" ON |
48 | "role_assignments"."resource_id" = "profiles"."environment_id" AND | 48 | "role_assignments"."resource_id" = "profiles"."environment_id" AND |
49 | "role_assignments"."resource_type" = \'Environment\'') | 49 | "role_assignments"."resource_type" = \'Environment\'') |