Class: UserData

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
EnumHumanizable
Defined in:
app/models/user_data.rb

Constant Summary collapse

GENDERS =
{
  male: 1,
  female: 2,
  other: 3,
  unspecified: 0
}

Instance Method Summary collapse

Instance Method Details

#birth_dateObject


21
22
23
# File 'app/models/user_data.rb', line 21

def birth_date
  Date.new(birth_year, birth_month, birth_day) if birth_year && birth_month && birth_day
end

#birth_date=(date) ⇒ Object


25
26
27
28
29
30
31
32
33
34
35
# File 'app/models/user_data.rb', line 25

def birth_date=(date)
  if date && (date = date.to_date)
    self.birth_year = date.year
    self.birth_month = date.month
    self.birth_day = date.day
  else
    self.birth_year = nil
    self.birth_month = nil
    self.birth_day = nil
  end
end