Class: Profile

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
ActiveModel::ForbiddenAttributesProtection
Defined in:
app/models/profile.rb

Instance Method Summary collapse

Instance Method Details

#ageObject



42
43
44
45
46
# File 'app/models/profile.rb', line 42

def age
  return nil if self.birthday.blank? 
  now = Time.now.utc.to_date
  now.year - self.birthday.year - (self.birthday.to_date.change(:year => now.year) > now ? 1 : 0)
end

#birthday=(value) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/models/profile.rb', line 23

def birthday=(value)
  
  puts "He entrado en el metodo birthday con un :" + value.class.to_s 
        
  if value.blank?
    @birthday_formatted_invalid = false    
    super value
  else
    begin
      #super Date.parse(value)
      super value
      @birthday_formatted_invalid = false
    rescue 
      @birthday_formatted_invalid = true
    end
  end

end

#subjectObject

The subject of this profile



49
50
51
# File 'app/models/profile.rb', line 49

def subject
  actor.try(:subject)
end