uses Date#age_in_years when calculating ages
This commit is contained in:
@@ -247,14 +247,7 @@ class User < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def age
|
||||
if date_of_birth.blank?
|
||||
nil
|
||||
else
|
||||
now = Time.now.utc.to_date
|
||||
now.year - date_of_birth.year - (
|
||||
(now.month > date_of_birth.month || (now.month == date_of_birth.month && now.day >= date_of_birth.day)
|
||||
) ? 0 : 1)
|
||||
end
|
||||
date_of_birth.try(:age_in_years)
|
||||
end
|
||||
|
||||
def save_requiring_finish_signup
|
||||
|
||||
Reference in New Issue
Block a user