Skip to content

Instantly share code, notes, and snippets.

@Keqi
Last active January 9, 2020 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Keqi/7790ddb0ddfc43cfc414687c4691abcf to your computer and use it in GitHub Desktop.
Save Keqi/7790ddb0ddfc43cfc414687c4691abcf to your computer and use it in GitHub Desktop.
class ProjectsController < ApplicationController
# student.project is the reference to associated AR Project model.
def users_projects
teams = Team.all
students = teams.map(&:students).flatten
@student_projects = students.select do |student|
student.project.status == "Active"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment