Module: Model::Profile

Extended by:
ActiveSupport::Concern
Included in:
Profiled::Profile
Defined in:
app/models/profiled/model/profile.rb

Instance Method Summary collapse

Instance Method Details

#ageObject



30
31
32
33
34
# File 'app/models/profiled/model/profile.rb', line 30

def age
  return 0 unless self.birthday
  r_hash = TimeHelper.exact_distance_time(self.birthday, Date.today)
  r_hash[:year]
end

#age_strObject



36
37
38
39
40
# File 'app/models/profiled/model/profile.rb', line 36

def age_str
  return '未知' unless self.birthday
  r_hash = TimeHelper.exact_distance_time(self.birthday, Date.today)
  "#{r_hash[:year]}#{r_hash[:month]}"
end