Class: AnimalWeight

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

Instance Method Summary collapse

Methods included from CommonScopes

included

Instance Method Details

#as_xls(options = {}) ⇒ Object


25
26
27
28
29
30
31
32
# File 'app/models/animal_weight.rb', line 25

def as_xls(options = {})
  {
      "Id" => id.to_s,
      "Weight" => weight,
      "Animal" => animal["name"],
      "Date of Weight" => date_of_weight
  }
end

#formatted_weight_dateObject


16
17
18
19
20
21
22
23
# File 'app/models/animal_weight.rb', line 16

def formatted_weight_date
  unless self.date_of_weight.blank?
    age = self.date_of_weight.strftime('%a, %b %e at %l:%M')
  else
    age = ''
  end
  return age
end

#show_weight_label_methodObject

show the link in the admin UI instead of the link id


12
13
14
# File 'app/models/animal_weight.rb', line 12

def show_weight_label_method
  self.weight.to_s
end