I have two models
class Project
has_one: user
end
class User
# Attributes
# active: Boolean
# under_18: Boolean
def can_work?
active? && under_18 == false
end
end
The logic for can_work?
if active is true and under_18 is false then they can work
I want to do something like this but it's not possible
Project.all.joins(:user).where('users.can_work? = ?', false)
Essentially what I'm looking for is to find all users who can't work
I know I can use Scope, but copying the logic that I specified above in scope is confusing.
Here's the scenario that I'm looking for
active | under_18
------------------
T T = F
T F = T
F T = F
F F = F
Thanks