app/models/project.rb
# general method for assigning the people with roles, according to the role passed in.
# e.g. for a role of :gatekeeper, gatekeeper_ids attribute is used to set the people for that role
general method for assigning the people with roles, according to the role passed in.
general method for assigning the people with roles according to the role passed in .
def handle_admin_role_ids(role)
    current_members = send(role.to_s.pluralize)
    new_members = Person.find(send("#{role}_ids"))
    to_add = new_members - current_members
    to_remove = current_members - new_members
    to_add.each do |person|
      person.send("is_#{role}=", [true, self])
      disable_authorization_checks { person.save! }
    end
    to_remove.each do |person|
      person.send("is_#{role}=", [false, self])
      disable_authorization_checks { person.save! }
    end
  end
def handle_admin_role_ids ( role ) current_members = send ( role . to_s . pluralize ) new_members = Person . find ( send ( "#{role}_ids" ) ) to_add = new_members - current_members to_remove = current_members - new_members to_add . each do | person | person . send ( "is_#{role}=" , [ true , self ] ) disable_authorization_checks { person . save! } end to_remove . each do | person | person . send ( "is_#{role}=" , [ false , self ] ) disable_authorization_checks { person . save! } end end
general method for assigning the people with roles, according to the role passed in.
general method for assigning the people with roles according to the role passed in .
role