Commit d01f1a4190da214d9d5904eb21b181c40304b61a
Exists in
master
and in
29 other branches
Merge branch 'quick_bug_fix' into 'master'
Quick bug fix: Missing brace on Person.rb Missing brace "}" on Person.rb and identation fix See merge request !452
Showing
1 changed file
with
6 additions
and
6 deletions
Show diff stats
app/models/person.rb
@@ -25,7 +25,7 @@ class Person < Profile | @@ -25,7 +25,7 @@ class Person < Profile | ||
25 | scope :not_members_of, lambda { |resources| | 25 | scope :not_members_of, lambda { |resources| |
26 | resources = [resources] if !resources.kind_of?(Array) | 26 | resources = [resources] if !resources.kind_of?(Array) |
27 | conditions = resources.map {|resource| "role_assignments.resource_type = '#{resource.class.base_class.name}' AND role_assignments.resource_id = #{resource.id || -1}"}.join(' OR ') | 27 | conditions = resources.map {|resource| "role_assignments.resource_type = '#{resource.class.base_class.name}' AND role_assignments.resource_id = #{resource.id || -1}"}.join(' OR ') |
28 | - { :select => 'DISTINCT profiles.*', :conditions => ['"profiles"."id" NOT IN (SELECT DISTINCT profiles.id FROM "profiles" INNER JOIN "role_assignments" ON "role_assignments"."accessor_id" = "profiles"."id" AND "role_assignments"."accessor_type" = (\'Profile\') WHERE "profiles"."type" IN (\'Person\') AND (%s))' % conditions] | 28 | + { :select => 'DISTINCT profiles.*', :conditions => ['"profiles"."id" NOT IN (SELECT DISTINCT profiles.id FROM "profiles" INNER JOIN "role_assignments" ON "role_assignments"."accessor_id" = "profiles"."id" AND "role_assignments"."accessor_type" = (\'Profile\') WHERE "profiles"."type" IN (\'Person\') AND (%s))' % conditions] } |
29 | } | 29 | } |
30 | 30 | ||
31 | scope :by_role, lambda { |roles| | 31 | scope :by_role, lambda { |roles| |
@@ -64,9 +64,9 @@ roles] } | @@ -64,9 +64,9 @@ roles] } | ||
64 | ScopeTool.union *scopes | 64 | ScopeTool.union *scopes |
65 | end | 65 | end |
66 | 66 | ||
67 | - def memberships_by_role(role) | ||
68 | - memberships.where('role_assignments.role_id = ?', role.id) | ||
69 | - end | 67 | + def memberships_by_role(role) |
68 | + memberships.where('role_assignments.role_id = ?', role.id) | ||
69 | + end | ||
70 | 70 | ||
71 | has_many :friendships, :dependent => :destroy | 71 | has_many :friendships, :dependent => :destroy |
72 | has_many :friends, :class_name => 'Person', :through => :friendships | 72 | has_many :friends, :class_name => 'Person', :through => :friendships |
@@ -141,12 +141,12 @@ roles] } | @@ -141,12 +141,12 @@ roles] } | ||
141 | end | 141 | end |
142 | 142 | ||
143 | def add_friend(friend, group = nil) | 143 | def add_friend(friend, group = nil) |
144 | - unless self.is_a_friend?(friend) | 144 | + unless self.is_a_friend?(friend) |
145 | friendship = self.friendships.build | 145 | friendship = self.friendships.build |
146 | friendship.friend = friend | 146 | friendship.friend = friend |
147 | friendship.group = group | 147 | friendship.group = group |
148 | friendship.save | 148 | friendship.save |
149 | - end | 149 | + end |
150 | end | 150 | end |
151 | 151 | ||
152 | def already_request_friendship?(person) | 152 | def already_request_friendship?(person) |