Refactor abilities. Added ProjectUpdate context. Fixed few bugs with namespaces

This commit is contained in:
Dmitriy Zaporozhets 2012-11-29 07:29:11 +03:00
parent a1ffc673b9
commit eb1004f789
18 changed files with 127 additions and 53 deletions

View file

@ -123,4 +123,11 @@ class User < ActiveRecord::Base
self.password = self.password_confirmation = Devise.friendly_token.first(8)
end
end
def accessed_groups
@accessed_groups ||= begin
groups = Group.where(id: self.projects.pluck(:namespace_id)).all
groups + self.groups
end
end
end