4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'app/models/task_type.rb', line 4
def locate_appropriate_by_user_type(current_user)
if current_user.is_student? && current_user.is_staff?
task_types = TaskType.find(:all)
end
if current_user.is_student? && !current_user.is_staff?
task_types = TaskType.find(:all, :conditions => ['is_student = ?', true])
end
if !current_user.is_student? && current_user.is_staff?
task_types = TaskType.find(:all, :conditions => ['is_staff = ?', true])
end
if !current_user.is_student? && !current_user.is_staff?
task_types = TaskType.find(:all)
end
return task_types
end
|