Class: UserProfile

Inherits:
ApplicationRecord show all
Defined in:
app/models/user_profile.rb

Constant Summary collapse

NAME_LIMIT =
100

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.entity_parametersObject



13
14
15
16
# File 'app/models/user_profile.rb', line 13

def self.entity_parameters
  excluded = %w(id user_id created_at updated_at)
  column_names.reject { |c| excluded.include? c }
end

Instance Method Details

#ageObject



22
23
24
25
26
27
28
# File 'app/models/user_profile.rb', line 22

def age
  now    = Time.now
  bd     = birthday || now
  result = now.year - bd.year
  result = result - 1 if (bd.month > now.month || (bd.month >= now.month && bd.day > now.day))
  result
end

#search_stringObject



18
19
20
# File 'app/models/user_profile.rb', line 18

def search_string
  "#{name} #{surname}"
end