You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
543 B
23 lines
543 B
class ProjectInfo < ActiveRecord::Base
|
|
attr_accessible :project_id, :user_id
|
|
|
|
belongs_to :project
|
|
belongs_to :user
|
|
validates_presence_of :project_id, :user_id
|
|
validates_uniqueness_of :project_id, :scope => :user_id
|
|
after_save :update_user_level
|
|
def self.manager? (user_id, project)
|
|
for project_info in project.project_infos
|
|
if project_info.user_id == user_id
|
|
return true
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
#更新用户等级
|
|
def update_user_level
|
|
UserLevels.update_user_level(self.user)
|
|
end
|
|
end
|