Created
August 16, 2016 21:54
-
-
Save anonymous/ad9aec0685872b4b4e5779cdaa25f007 to your computer and use it in GitHub Desktop.
This file contains 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 Person | |
def self.where_age(age) | |
min = Date.current - age.to_i.years - 1.year | |
max = Date.current - age.to_i.years + 1.day | |
where(date_of_birth: min..max) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment