noosfero | 2 new commits pushed to repository
Larissa Reis
gitlab at gitlab.com
Tue Feb 3 22:05:22 BRST 2015
Larissa Reis pushed to refs/heads/master at <a href="https://gitlab.com/noosfero/noosfero">Noosfero / noosfero</a>
Commits:
<a href="https://gitlab.com/noosfero/noosfero/commit/6591bcb48804e7e00682391d61821ef95699848f">6591bcb4</a> by Tallys Martins
Fixing identation and missing brace on person.rb
- - - - -
<a href="https://gitlab.com/noosfero/noosfero/commit/d01f1a4190da214d9d5904eb21b181c40304b61a">d01f1a41</a> by Larissa Reis
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
- - - - -
Changes:
=====================================
app/models/person.rb
=====================================
--- a/app/models/person.rb
+++ b/app/models/person.rb
@@ -25,7 +25,7 @@ class Person < Profile
scope :not_members_of, lambda { |resources|
resources = [resources] if !resources.kind_of?(Array)
conditions = resources.map {|resource| "role_assignments.resource_type = '#{resource.class.base_class.name}' AND role_assignments.resource_id = #{resource.id || -1}"}.join(' OR ')
- { :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]
+ { :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] }
}
scope :by_role, lambda { |roles|
@@ -64,9 +64,9 @@ roles] }
ScopeTool.union *scopes
end
- def memberships_by_role(role)
- memberships.where('role_assignments.role_id = ?', role.id)
- end
+ def memberships_by_role(role)
+ memberships.where('role_assignments.role_id = ?', role.id)
+ end
has_many :friendships, :dependent => :destroy
has_many :friends, :class_name => 'Person', :through => :friendships
@@ -141,12 +141,12 @@ roles] }
end
def add_friend(friend, group = nil)
- unless self.is_a_friend?(friend)
+ unless self.is_a_friend?(friend)
friendship = self.friendships.build
friendship.friend = friend
friendship.group = group
friendship.save
- end
+ end
end
def already_request_friendship?(person)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150204/b78d3abe/attachment.html>
More information about the Noosfero-dev
mailing list