This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Project < ApplicationRecord | |
| # We have 2 scopes, one for projects In Progress and one for projects Not Started | |
| scope :in_progress, -> {where(project_stage: "In Progress")} | |
| scope :not_started, -> {where(project_stage: "Not Started")} | |
| # Say we want to combine the scopes so we can see projects | |
| # that are in progress or that have been awarded, but not started | |
| # This is where OR is handy :) | |
| scope :project_status, -> {in_progress.or(not_started)} | |
| end |